[Rd] What to do re 'replacing previous import' errors
Duncan Murdoch
murdoch.duncan at gmail.com
Sat May 20 11:50:52 CEST 2017
On 20/05/2017 5:14 AM, Ronald Barry wrote:
> After looking at a few discussions of this problem online, I can't seem to
> find a good solution. When running a CHECK on a package I'm working on
> (which passed all tests a few years ago), I get the following 'significant
> warning':
>
> Warning: replacing previous import ‘spam::tail’ by ‘utils::tail’ when
> loading ‘latticeDensity’
> Warning: replacing previous import ‘spam::head’ by ‘utils::head’ when
> loading ‘latticeDensity’
>
> Humorously enough, I don't use the 'tail' function anywhere. It seems to
> be some sort of namespace clash between spam and utils. In my namespace,
> I'm importing spam and utils. Is there a fix for this problem? Thanks.
It's generally a good idea to import only the functions you need, not
everything. If latticeDensity used
importFrom(utils, foo, bar)
etc., then it would only get a clash if you explicitly imported two
things with the same name. (You can do a rename when importing if you
really want to do that.)
Duncan Murdoch
More information about the R-devel
mailing list