[Rd] checking whether the name space can be loaded with stated dependencies

hadley wickham h.wickham at gmail.com
Fri Jan 4 15:15:45 CET 2008


On 1/4/08, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
> What it is trying is
>
> % env R_DEFAULT_PACKAGES=NULL R
>
> > loadNamespace("ggplot2")
>
> The test is not new, so it would seem to be a change in ggplot2 since the
> version on CRAN.  My guess is the your package is doing top-level
> computations, which `Writing R Extensions' warns against:
>
>    The R code files should only create R objects and not call functions
>    with side effects such as require and options.

Thanks for the additional info. I've grepped for ^[^#\n ]+\(  (which I
think should find any top-level function call) and didn't find
anything. I certainly can't think of any top level computations that
I'm doing apart from creating R functions and objects.  Is there
anyway to get more details about what exactly I've done wrong?
Calling traceback after loadNamespace isn't helpful.

> If you must deviate from that, you need to arrange for the environment you
> need: when loading a name space the Depends: packages are not loaded.

Is this a recent change to R? The package appears to work fine after
installation so I presume this check is protecting me from some more
subtle danger.

If it's helpful, my depends line is:
Depends: R (>= 2.6), grid, reshape (>= 0.8.0), proto, splines, MASS,
  RColorBrewer, colorspace

so only proto or RColorBrewer should be a problem.

Hadley

-- 
http://had.co.nz/



More information about the R-devel mailing list