Hadley sent me the package, and my guess *was* correct. The package is not using lazy-loading, and early on it has (in aaa-top-level.r)
TopLevel <- proto(expr = { ... That is 'a top-level computation'. To make this work, you need require("proto") in that file. It also needs require("grid"). The Depends: packages are available when the package is installed, but not when the namespace is loaded. On Fri, 4 Jan 2008, Prof Brian Ripley wrote: > On Fri, 4 Jan 2008, hadley wickham wrote: > >> On 1/4/08, Prof Brian Ripley <[EMAIL PROTECTED]> 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? > > As I said, that was a guess: if it is not the cause then I am in the dark. > If you can send me the version doing this I can try to dig further. > >> 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? > > No: that wording is ancient, and the test is not recent. > >> The package appears to work fine after >> installation so I presume this check is protecting me from some more >> subtle danger. > > The danger is that if some other package (or a user) does > ggplot2::some_function_in_ggplot2 that this will fail if the package is > not attached, similarly if a package name space imports from ggplot2. > >> 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 >> >> > > -- Brian D. Ripley, [EMAIL PROTECTED] 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 ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel