Skip to content

[R-pkg-devel] Warning: replacing previous import ...

2 messages · Christian Hennig, Ralf Stubner

#
Dear list,

I'm maintainer of the fpc package and got an email that I need to 
replace a warning that has come up. The warning is:

"Warning: replacing previous import ?mclust::dmvnorm? by 
?mvtnorm::dmvnorm? when loading ?fpc?"

Back story: A few month ago I was contacted by the maintainer of mclust 
that they now incorporate their own dmvnorm function. As dmvnorm is used 
in my package, he suggested to replace all dmvnorm by mvtnorm::dmvnorm, 
which I did. Initially this was accepted without warning by CRAN.

I don't really understand what I should do about the warning. Isn't 
mvtnorm::dmvnorm the way to do this, if I want to go on using mvtnorm's 
dmvnorm function? All "dmvnorm" occurrences in my package are now 
mvtnorm::dmvnorm as intended and requested. Both mclust and mvtnorm are 
imported. The only (probably somewhat stupid) idea I have is to list the 
import of? mvtnorm before mclust in NAMESPACE (currently mclust is 
imported forst), but this seems silly to me - what if I wanted to use 
both mvtnorm::dmvnorm and mclust::dmvnorm?

Any hint?

Thanks,

Christian
#
Hi Christian,

in your NAMESPACE you import both mvtnorm and mclust completely. The
warning should go away if you change this to importFrom(...) with only
the methods you actually need, in particular dmvnorm either from
mvtnorm or from mclust. Alternatively, you could leave out the imports
and always use the fully qualified names. This makes it easy to use
both mvtnorm::dmvnorm and mclust::dmvnorm in the same package.

cheerio
ralf

On Fri, Jun 28, 2019 at 1:10 PM Christian Martin Hennig
<christian.hennig at unibo.it> wrote: