[R-pkg-devel] [External] Re: Farming out methods to other packages

Iñaki Ucar |uc@r @end|ng |rom |edor@project@org
Sun Aug 11 01:05:11 CEST 2019

On Sat, 10 Aug 2019 at 21:11, Lenth, Russell V <russell-lenth using uiowa.edu> wrote:
> Thanks Iñaki,
> However...
>     > 1) renaming those methods (e.g., recover_data_foo, because as soon as there is a something.foo
>     > in your namespace, it will be dispatched regardless of whether you register it or not)
> If I do that, then emmeans won't support foo objects until foopkg offers the methods. My goal is to encourage package developers to replace my existing methods but to support them until that is done.

A method doesn't need to be named something.foo to register it for foo
objects. You can register any function name as a method for any class
and any generic, thus avoiding the automatic dispatch on these special
names *.foo.

What I'm suggesting is that, in .onLoad, if getS3method returns
something for recover_data and class foo, then that's fine. If not,
you can register you recover_data_foo.


More information about the R-package-devel mailing list