On Thu, Aug 22, 2013 at 10:05 AM, R. Michael Weylandt
<michael.weyla...@gmail.com> <michael.weyla...@gmail.com> wrote:
>
>
> On Aug 22, 2013, at 9:09, Michael Friendly <frien...@yorku.ca> wrote:
>
>> In checking my vcdExtra package, the following NOTE newly appeared (R-Forge, 
>> using R version 3.0.1 Patched (2013-08-20 r63635))
>>
>> Package in Depends field not imported from: ‘gnm’
>>  These packages needs to imported from for the case when
>>  this namespace is loaded but not attached.
>>
>> In the DESCRIPTION file, I have
>>
>> Depends: R (>= 2.10), vcd, gnm (>= 1.0.3)
>>
>> In NAMESPACE:
>>
>> # we are a vcd extension
>> import(vcd)
>>
>> I've read 1.1.1 of R-Exts, but it is not clear to me whether I should also 
>> import gnm or change
>> the DESCRIPTION file to use
>>
>> Imports: vcd, gnm (>= 1.0.3)
>>
>> R-Exts says: The ‘Imports’ field lists packages whose namespaces are 
>> imported from (as specified in the
>> NAMESPACE file) but which do not need to be attached, but how can I tell if 
>> gnm needs to be attached?
>
> I think the current best practice is to use Imports unless gnm provides 
> functions the end user needs in order to use your package.
>
> Practically, I think this usually comes down to asking whether gnm provides 
> relevant generics -- if you provide methods only, the end user would only be 
> able to call them directly (ick!) unless gnm is both loaded and attached 
> (Depends)
>
> If gnm is tools for your code, but not the user to call directly, Imports is 
> cleaner.
>
> Does that help?
>
> Michael
>
>>
>> Also, what is the difference between Imports: in DESCRIPTION and imports() 
>> in NAMESPACE?
>>
>
> One enables the other: Imports in DESCRIPTION allows for both imports() and 
> importsFrom(). It could probably be automatic, but the DESC file is much 
> older than the NAMESPACE file.

I pretty sure you can also use import()/importFrom() in NAMESPACE for
packages listed under Depends in DESCRIPTION.

/Henrik

>
>
>> -Michael
>>
>> --
>> Michael Friendly     Email: friendly AT yorku DOT ca
>> Professor, Psychology Dept. & Chair, Quantitative Methods
>> York University      Voice: 416 736-2100 x66249 Fax: 416 736-5814
>> 4700 Keele Street    Web:   http://www.datavis.ca
>> Toronto, ONT  M3J 1P3 CANADA
>>
>> ______________________________________________
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>
> ______________________________________________
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to