[R-pkg-devel] two functions with the same name when importing
Martin Morgan
mtmorg@n@b|oc @end|ng |rom gm@||@com
Thu Nov 7 10:34:10 CET 2019
RShowDoc("R-exts") setion 1.5.1 Specifying imports and exports indicates that imports() has an except= argument, so
import(adegenet, except = plot)
might do the trick. Use it in your package as `adegenet::plot()`.
Martin Morgan
On 11/6/19, 8:31 PM, "R-package-devel on behalf of Duncan Murdoch" <r-package-devel-bounces using r-project.org on behalf of murdoch.duncan using gmail.com> wrote:
On 06/11/2019 6:50 p.m., Bernd.Gruber wrote:
> Hi,
>
> I have a problem regarding the name of two functions and I know the "correct" way is to use importFrom to make sure only specified functions are imported. But my problem is that my package really depends on another package
> adegenet as I basically use 90% of the say >100 functions.
>
> So when I import all of adegenet I get:
>
> 2: replacing previous import 'adegenet::plot' by 'graphics::plot' when loading 'dartR'
>
>
> So in essence I think adegenet is importing a plot function which collides with the basic plot function. Is there anything I can do, without going through 100 functions and using importFrom
>
> In addition I actually need the plot function from adegenet, so I would need to rename it as well somehow.
>
> Any hint how to solve this would be highly appreciated.
Just get a copy of the adegenet NAMESPACE file to get all of its
exports. Edit the list down to the ones you use, and use a text editor
to change the export directives to importFrom directives. It's not
really that hard.
The path to the NAMESPACE file is given by
system.file("NAMESPACE", package="adegenet")
Duncan Murdoch
______________________________________________
R-package-devel using r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel
More information about the R-package-devel
mailing list