Skip to content

[R-pkg-devel] requireNamespace and nested Depends

2 messages · Carroll, Robert J, Uwe Ligges

#
Hello everyone-

I've been updating a package (https://github.com/PheWAS/PheWAS/tree/0.10) to comply with R 3.2.0 depends, suggests, and imports standards.

PheWAS suggests snowfall as it uses snowfall just to add parallelization. I was using a require call previously if a user specified the parallel option in one of my functions; the new standards ask for a requireNamespace call with :: specified function calls for suggested packages instead. Unfortunately, snowfall depends on the package snow via DESCRIPTION, but does not import it in NAMESPACE. When executed, the function call to snowfall::sfInit fails when it attempts to call snow functions. Adding a requireNamespace call for snow does not attach or put the namespace in any resolve/search path, so a call to sfInit still fails.

The "best" solution would likely be to update snowfall's NAMESPACE to include import(snow), but this is not in my control. Alternatively, I could add snow and/or snowfall to my Depends and import list. This would work, but it's not necessary for the function of the package, so it is more appropriate as a suggest. I could also do some specific imports, but that is still a suboptimal solution.

Is there a best practice here? Should I go for the simple solution and just add snowfall as a dependency? Snow and snowfall don't have any big dependencies themselves, so it shouldn't be much of a problem to just import them.

Thank you for any perspectives on this issue!
-Robert

Robert J Carroll, PhD
Department of Biomedical Informatics
Vanderbilt University School of Medicine
Robert.J.Carroll at Vanderbilt.edu
(615) 875-3253
#
It makes more sense to rely on something that uses package parallel 
these days (rather than snowfall/snow).

Most snow functionality has been ported to parallel and partly improved 
there and snowfall has not been updated for a long time....

Best,
Uwe Ligges
On 22.05.2015 21:33, Carroll, Robert J wrote: