[R-pkg-devel] [External] Re: Two packages with the same generic function

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Tue Jun 23 12:25:18 CEST 2020


On 23/06/2020 4:22 a.m., Guido Schwarzer wrote:
> Am 23.06.20 um 10:00 schrieb Viechtbauer, Wolfgang (SP):
>> [...]
>> @Neal: A separate package with generic functions that pkgA and pkgB could import is an interesting suggestion, thanks!
> 
> What makes this interesting is that there is no dependency on other
> packages in generics.
> 
> Remains the question which help page would be shown for help(foo).

If a package imports and then exports the generic, it would normally 
create a help page referring to the original one where the generic is 
defined.  So both pkgA and pkgB would probably both create help pages, 
and the help system would show a page listing them both plus the generic 
one, and asking the user to choose.

An example happens if you use

library(broom)
?tidy

The broom package links to a page that says "These objects are imported 
from other packages. Follow the links below to see their documentation."
One of the links is to the ?tidy page in the generics package.

You are allowed to say ?broom::tidy, and then you don't go to the list 
of possibilities, you go directly to the one you asked for.

Duncan Murdoch



More information about the R-package-devel mailing list