[R] Package dev: Depends, require, SaveImage best practices?
sfalcon at fhcrc.org
Fri Dec 3 19:55:58 CET 2004
I'm trying to sort out some best practices for package development and
understand some behavior of R CMD check that has me confused.
Best practice question: If a package foo appears in the Depends field in
the DESCRIPTION file of mypkg, should I refrain from using require(foo)
in the R source files of mypkg?
The Writing R Extensions manual says this about the Depends field:
... the list of packages which is specified will be attached before
the current package, both when library is called and when saving an
image or preparing for lazy-loading.
I conclude that I need not require() a package that I've listed in
Depends. However, this isn't always working for me. I have a package
that has Ruuid in Depends. If I also have SaveImage: Yes, then R CMD
check completes without error. However, if I omit SaveImage, then I get
$ R CMD check graph
WARNING: ignoring environment value of R_HOME
* checking for working latex ... OK
* using log directory
* checking for file 'graph/DESCRIPTION' ... OK
* checking if this is a source package ... OK
* Installing *source* package 'graph' ...
make: `graph.so' is up to date.
** preparing package for lazy loading
Error in assign("nullgraphID", getuuid()) :
couldn't find function "getuuid"
ERROR: lazy loading failed for package 'graph'
To conclude: what am I missing? Would it be better to just
require(Ruuid)? Always use SaveImage?
More information about the R-help