From h.wickham at gmail.com  Fri Jan  4 15:15:45 2008
From: h.wickham at gmail.com (hadley wickham)
Date: Fri, 4 Jan 2008 08:15:45 -0600
Subject: [Rd] checking whether the name space can be loaded with stated
	dependencies
In-Reply-To: <Pine.LNX.4.64.0801040237590.26624@gannet.stats.ox.ac.uk>
References: <f8e6ff050801031831j36005a1cw8449a6f65481845b@mail.gmail.com>
	<Pine.LNX.4.64.0801040237590.26624@gannet.stats.ox.ac.uk>
Message-ID: <f8e6ff050801040615t3469f32cldfe27bedc5539b1@mail.gmail.com>

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/



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