[Rd] "False" warning on "replacing previous import" when re-exporting identical object

Henrik Bengtsson hb at biostat.ucsf.edu
Fri Aug 30 05:38:24 CEST 2013


Consider three packages PkgA, PkgB and PkgC.

PkgA defines a generic function foo() and exports it;


PkgB imports PkgA::foo() and re-exports it;

importFrom(PkgA, foo)

PkgC imports everything from PkgA and PkgB:

imports(PkgA, PkgB)

Loading or attaching the namespace of PkgC will generate a warning:

  replacing previous import by 'PkgA::foo' when loading 'PkgC'

This in turn causes 'R CMD check' on PkgC to generate a WARNING (no-go at CRAN):

* checking whether package 'PkgC' can be installed ... WARNING
Found the following significant warnings:
  Warning: replacing previous import by 'PkgA::foo' when loading

Isn't it valid to argue that this is a "false" warning, because
identical(PkgB::foo, PkgA::foo) is TRUE and therefore has no effect?


PS. The above can be avoided by using explicit importFrom() on PkgA
and PkgB, but that's really tedious.  In my case this is out of my
reach, because I'm the author of PkgA and PkgB but not many of the
PkgC packages.

More information about the R-devel mailing list