[Rd] Including a single function from a package

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri May 5 14:55:36 CEST 2006


On Fri, 5 May 2006, 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."

When do you get the error?

> My NAMESPACE file consists of the following:
> importFrom(MASS, mvrnorm)
> importFrom(gsl, hyperg_2F1)
> exportPattern("^[^\\.]")

Does your DESCRIPTION file contain

Imports: MASS gsl

?

> 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 is a big deal: your code will fail in 2.4.0 and not be allowed on CRAN 
now.  The message is probably not to do with that topic but to do with 
loading your package.  So can you install and load the package without any 
messages?

> 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.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list