[Rd] Importing function that is previously imported by other package

Duncan Murdoch murdoch.duncan at gmail.com
Fri Sep 6 12:53:24 CEST 2013


On 13-09-06 5:36 AM, Ulrike Grömping wrote:
> 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
>

I think we need to see the details.  I don't get those warnings with the 
version on CRAN.  Perhaps you are importing it twice, e.g.

import(combinat)
importFrom(utils, combn)

?

Duncan Murdoch



More information about the R-devel mailing list