[Rd] Depends vs Imports
R. Michael Weylandt
michael.weylandt at gmail.com
Thu Aug 1 04:41:51 CEST 2013
On Wed, Jul 31, 2013 at 7:35 PM, Simon Urbanek
<simon.urbanek at r-project.org> wrote:
>
> On Jul 31, 2013, at 7:14 PM, Paul Gilbert wrote:
>
>> I am being asked to modernize the Depends line in the DESCRIPTION file of some packages. Writing R Extensions says:
>>
>> The general rules are
>>
>> Packages whose namespace only is needed to load the package using
>> library(pkgname) must be listed in the ‘Imports’ field and not in
>> the ‘Depends’ field. Packages listed in imports or importFrom
>> directives in the NAMESPACE file should almost always be in
>> ‘Imports’ and not ‘Depends’.
>>
>> Packages that need to be attached to successfully load the
>> package using library(pkgname) must be listed in the
>> ‘Depends’ field, only.
>>
>> Could someone please explain a few points I thought I understood but obviously do not, or point to where these are explained:
>>
>> -What does it mean for the namespace only to be needed? I thought the namespace was needed if the package or some of its functions were mentioned in the NAMESPACE file, and that only the namespace was needed if only the generics were called, and not other functions. The above suggests that I may be wrong about this. If so, that is, Imports will usually suffice, then when would Depends ever be needed when a package is mentioned in the NAMESPACE file?
>>
>
> In the namespace era Depends is never really needed. All modern packages have no technical need for Depends anymore. Loosely speaking the only purpose of Depends today is to expose other package's functions to the user without re-exporting them.
>
Just to make sure I understand this: an example would be if A provides
an S3 generic and B provides a (registered but unexported) method for
that generic -- this would be a great time for B to list A as
"Depends" instead of "Imports" to make sure the generic is available
to the user?
Thanks,
Michael
More information about the R-devel
mailing list