If in my package "Foo" I call a function from another package "Bar" if it's available, according to R-exts, this sounds like I should include "Suggests: Bar" in package Foo's description. But the manual is silent on how to treat Bar's namespace. Should I import it? If so, should this be conditional or unconditional? There is a thread from 2008 in which Duncan Murdoch suggests trying conditionally importing a package if it's installed, with the caveat "If this is allowed" (http://tolstoy.newcastle.edu.au/R/e5/devel/08/10/0488.html). This appears to work in current release of R, 2.15.2, but I'm still not clear if it's officially allowed, much less recommended.
The manual also says: > If a package only needs a few objects from another package it can use a fully > qualified variable reference in the code instead of a formal import. A fully > qualified reference to the function f in package foo is of the form foo::f. > This is slightly less efficient than a formal import and also loses the > advantage of recording all dependencies in the NAMESPACE file, so this > approach is usually not recommended. Evaluating foo::f will cause package foo > to be loaded, but not attached, if it was not loaded already—this can be an > advantage in delaying the loading of a rarely used package. > Would this be a better solution than importing when calling into a suggested package? Davor [[alternative HTML version deleted]]
______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel