When using S7 in a package, add two hooks to your zzz.R:
Call
S7_on_load()from.onLoad(). This is S7's way of registering methods, rather than usingNAMESPACEdirectives like S3 and S4 do. It ensures that methods for generics (S3, S4, and S7) defined in other packages are registered as needed when your package is loaded. This is only strictly necessary if you register methods for generics in other packages, but there's no harm in always including it and it ensures you won't forget later.Call
S7_on_build()at the top level (i.e. not inside.onLoad()) after all method registration is complete. This avoids embedding copies of external generics in your package when you usemethod<-.
S7_on_load() was previously known as methods_register(). This function is
retained for backward compatibility but new code should use S7_on_load().
See vignette("packages") for more details.