From groemping at beuth-hochschule.de  Fri Sep  6 13:06:36 2013
From: groemping at beuth-hochschule.de (=?ISO-8859-1?Q?Ulrike_Gr=F6mping?=)
Date: Fri, 6 Sep 2013 13:06:36 +0200
Subject: [Rd] Importing function that is previously imported by other
 package
In-Reply-To: <5229B424.9010905@gmail.com>
References: <5229A20A.3010601@beuth-hochschule.de> <5229B424.9010905@gmail.com>
Message-ID: <5229B73C.2040305@beuth-hochschule.de>

Am 06.09.2013 12:53, schrieb Duncan Murdoch:
> 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
Thanks, that guess was to the point, I did import it twice in my own 
namespace, once with utils in the import list, and once with importFrom.

Best, Ulrike

-- 
##############################################
## Prof. Dr. Ulrike Groemping
## FB II
## Beuth University of Applied Sciences Berlin
##############################################
## prof.beuth-hochschule.de/groemping
## Phone: +49(0)30 4504 5127
## Fax:   +49(0)30 4504 66 5127
## Home office: +49(0)30 394 04 863
##############################################



[Rd] Importing function that is previously imported by other package
=?ISO-8859-1?Q?Ulrike_Gr=F6mping?=