I extract information from objects whose classes are defined in different R-packages. For example, I extract coefficients from various statistical models (for which coefficient methods are not always implemented). I usually do not need to import these packages because I have defined a common function for which methods can be added by users. There is one method for each type of statistical model, and it would be foolish to import all these model definitions if the user is interested in only one specific type of model.
In some cases, however, I need to use the function defined in the package. For example, the confint.merMod method in the lme4 package. So far I have used package::function
to call these functions and wrapped this command in exists(function)
if-condition to make sure that the package really offers this function (since the function may be available only in some versions of the package).
However, I just discovered at http://developer.r-project.org/blosxom.cgi/R-devel/NEWS (see September 5, 2013) that in R version 3.0.2, "R CMD validation does more thorough checking of declared packages and namespaces. It tells objects [...] imported ':: which are not exported.
Does this mean that I really need to add export("function")
to the NAMESPACE file? Will the CMD check complain because the function is imported conditionally only?
source share