From hb at biostat.ucsf.edu  Fri Aug 30 05:38:24 2013
From: hb at biostat.ucsf.edu (Henrik Bengtsson)
Date: Thu, 29 Aug 2013 20:38:24 -0700
Subject: [Rd] "False" warning on "replacing previous import" when
 re-exporting identical object
Message-ID: <CAFDcVCQVWKxBr_07rZWqz=x8E296b6DNzNm4x8dVT4LQd3RDOg@mail.gmail.com>

Hi,

SETUP:
Consider three packages PkgA, PkgB and PkgC.

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

export(foo)

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

importFrom(PkgA, foo)
export(foo)

PkgC imports everything from PkgA and PkgB:

imports(PkgA, PkgB)


PROBLEM:
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
'CellularAutomaton'


FALSE?
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?


/Henrik

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.



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