From hb at biostat.ucsf.edu  Thu Aug 22 21:33:36 2013
From: hb at biostat.ucsf.edu (Henrik Bengtsson)
Date: Thu, 22 Aug 2013 12:33:36 -0700
Subject: [Rd] Confusion about Depends:, Imports:, Enhances:, import(),
	inportFrom()
In-Reply-To: <32CA103E-3F41-4051-B54E-A8EDD90BC694@gmail.com>
References: <52160D94.4010605@yorku.ca>
	<32CA103E-3F41-4051-B54E-A8EDD90BC694@gmail.com>
Message-ID: <CAFDcVCTY7Y4gTYz1u-U+OdrahFcsdD6WHU+0HR_szz73OxyWMQ@mail.gmail.com>

On Thu, Aug 22, 2013 at 10:05 AM, R. Michael Weylandt
<michael.weylandt at gmail.com> <michael.weylandt at gmail.com> wrote:
>
>
> On Aug 22, 2013, at 9:09, Michael Friendly <friendly at 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 at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] Confusion about Depends:, Imports:, Enhances:, import(), inportFrom()
Henrik Bengtsson