I'm trying to use Imports:
instead of Depends:
in the DESCRIPTION
files of my packages, yet I still feel I've got some more to understand on this ;-)
What I learned from this post (by the way: awesome post!!!) is that everything my package, say mypkg
, imports (say imported.pkg
) via Imports:
lives in environment imports:mypkg
instead of being attached to the search path. When trying to find foo
that ships with imported.pkg
, R looks in imports:mypkg
before traversing the search list. So far, so good.
Actual question
If imported.pkg
(imported by mypkg
) depends on a certain other package (stated in Depends:
section of the package's DESCRIPTION
file), do I need to make this very package a Depends:
dependency of my package in order for R to find functions of that package? So it seems to me at the moment as otherwise R complains.
Evidence
Seems like simply importing such a package is not enough. As an example, take package roxygen2
(CRAN). It depends on digest
while importing a bunch of other packages. I imported it (along with digest
as mypkg
also needs it) and checked environment imports:mypkg
which does list the digest
function: "digest" %in% parent.env(asNamespace("mypkg"))
returns TRUE
Yet when running roxygenize()
from within a function that is part of mypkg
, R complains that it can't find digest
.