Skip to content
Prev 46624 / 63424 Next

Importing function that is previously imported by other package

Dear developeRs,

I encounter the following problem: in the current version of my package 
FrF2, certain calls to a functioni do not work when package combinat is 
loaded, because function combn from combinat masks the function from 
utils that my package uses.
I tried to solve this issue by importing function combn into the 
namespace of FrF2; I don't need to export it, I just want to use it 
internally in the package; I could of course find all occurrences and 
replace them with utils::combn, but I thought that the namespace 
solution would be more elegant, faster, and in the spirit of R 
programming. The fix was successful: the installed package works with 
combinat on the search path.

However, when installing or loading the modified FrF2, I now get the 
warning "replacing previous import by utils::combn when loading 'FrF2'" 
(that's on R-devel, on production R the wording is slightly different, 
but there is also a warning). There is no warning from R CMD check, 
however. In case this is relevant: None of the packages in my "Depends" 
list mentions "utils" under depends, one of the packages FrF2 depends on 
also imports from utils, including utils::combn.

Shouldn't it be possible to have several packages IMport a function of 
the same name without a warning?

Best, Ulrike