[Rd] Including a single function from a package

Duncan Murdoch murdoch at stats.uwo.ca
Fri May 5 14:58:20 CEST 2006

On 5/5/2006 8:42 AM, Ken Kelley wrote:
> Hello all.
> I'm building a package where I want to include a function from two 
> different packages. In particular, I want to include mvrnorm and 
> hyperg_2F1 from MASS and gsl, respectively (but the specific functions 
> do not matter). With what I've tried after reading the "Specifying 
> imports and exports" section from the "Writing R Extensions" manual, I 
> get an error: "Namespace dependencies not required."
> My NAMESPACE file consists of the following:
> importFrom(MASS, mvrnorm)
> importFrom(gsl, hyperg_2F1)
> exportPattern("^[^\\.]")

I don't see this in a quick test in the current R-patched.

> A completely separate issue is that when running check, I get a warning 
> at the "checking S3 generic/method consistency" line that states: 
> "Warning: use of NULL environment is depreciated." I've looked at the 
> "Generic functions and methods" in the Writing R Extensions manual and 
> I'm still not sure what the "use of NULL environment is depreciated." I 
> suppose this is not a big deal, but it seems best not to have any warnings.

It indicates a bug somewhere or other, but the version of R you're using 
(you didn't say) is willing to work around it for now.  The next version 
will not.

 From the location where you saw the error, it looks like a bug in R 
rather than in your code, but surely such a thing would have been seen 
before.  Are you using an unreleased version?

This may also explain the problems with your namespace file.

Duncan Murdoch
> I'm sure I'm just missing something simple on both of these issues. Any 
> insight would be appreciated. I'm building the package with Win. XP.
> Thanks,
> Ken

More information about the R-devel mailing list