Seth Falcon
2004-Dec-03 18:55 UTC
[R] Package dev: Depends, require, SaveImage best practices?
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 this: $ R CMD check graph WARNING: ignoring environment value of R_HOME * checking for working latex ... OK * using log directory * '/home/sfalcon/proj-svn-unix/graph-proj/graph.Rcheck' * checking for file 'graph/DESCRIPTION' ... OK * checking if this is a source package ... OK * Installing *source* package 'graph' ... ** libs make: `graph.so' is up to date. ** R ** data ** inst ** preparing package for lazy loading Error in assign("nullgraphID", getuuid()) : couldn't find function "getuuid" Execution halted ERROR: lazy loading failed for package 'graph' ERROR Installation failed. To conclude: what am I missing? Would it be better to just require(Ruuid)? Always use SaveImage? Much tanks, + seth