[Rd] Depends vs Imports
pgilbert902 at gmail.com
Thu Aug 1 01:14:42 CEST 2013
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?
-Should the package DESCRIPTION make any accommodation for the
situation where users will probably need to directly call functions in
the imported package, even though the package itself does not?
-What does "need to be attached" mean? Is there a distinction
between a package being attached and a namespace being attached.
-Does "successfully load" mean something different from actually
using the package? That is, can we assume that if the package loads then
all the functions to run things will actually be found?
-If pkg1 uses a function foo in pkg3 indirectly, by a call to a
function in pkg2 which then uses foo, how should pkg1 indicate the
relationship with foo's pkg3, or is there no need to indicate any
relationship with pkg3 because that is all looked after by pkg2?
More information about the R-devel