On Thu, Sep 12, 2013 at 6:49 AM, Benjamin Hofner <benjamin.hof...@fau.de> wrote: > Hi, > > I am currently preparing a new version of my package papeR. When I run R CMD > check using the development version of R I get the following note: > > Package in Depends field not imported from: ‘nlme’, ‘lme4’, ‘survival’ > These packages needs to imported from for the case when > this namespace is loaded but not attached. > > I now have problems to fix this issue. It is easy to get rid of two of the > three package warnings by using > > import(lme4) > import(survival) > > in my NAMESPACE. Yet, I cannot import nlme as I then get the following > warnings: > > Warning: replacing previous import ‘VarCorr’ when loading ‘lme4’ > Warning: replacing previous import ‘lmList’ when loading ‘lme4’
This happens because 'lme4' re-exports the generic function VarCorr() that 'nlme' already exports. R considers this to be a conflict and generates a warnings, which is detected by 'R CMD check'. I've been trying to argue that this warning is unnecessary/not correct because in these cases, the two objects in conflict are actually the same identical object. You can see this by: > nlme::VarCorr function (x, sigma = 1, rdig = 3) UseMethod("VarCorr") <bytecode: 0x00000000111eb728> <environment: namespace:nlme> > lme4::VarCorr function (x, sigma = 1, rdig = 3) UseMethod("VarCorr") <bytecode: 0x00000000111eb728> <environment: namespace:nlme> Note how they are both in the same namespace, i.e. > identical(lme4::VarCorr, nlme::VarCorr) [1] TRUE I've submitted a patch for this 'Bug 15451 - PATCH: namespaceImportFrom() not to warn when the identical object is imported twice' on 2013-09-10 [https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=15451]. The tricky part is to convince R-core. Otherwise, the only solution I know of is either to use importFrom():s or to convince the author of 'lme4' to remove that re-export, which may not be possible. /Henrik > > I know that nlme is imported in lme4 but I cannot import both at the same > time. Can anyone help me here? I do *not* want or can use importFrom as I > rely on multiple functions and also rely on non-exported methods such as > summary.lme(). > > Thanks and all the best, > Benjamin > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/Importing-packages-in-Depend-tp4675947.html > Sent from the R devel mailing list archive at Nabble.com. > > ______________________________________________ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel