[Rd] Use of R_PROFILE.R / install.R

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Aug 9 21:34:28 CEST 2004


On Mon, 9 Aug 2004, Kurt Hornik wrote:

> >>>>> Prof Brian Ripley writes:
> 
> > According to R-exts:
> 
> >   The second purpose for @file{install.R} is to hold code that needs
> >   to be executed each time the package is attached, after the image is
> >   loaded.  Few packages have a need for such code so @file{install.R}
> >   is normally an empty file.
> 
> >   The optional file @file{R_PROFILE.R} is executed before the code in
> >   the @file{R} subdirectory and should be used to set up an
> >   environment needed only to evaluate the code (which is run with the
> >   @option{--vanilla} command-line flag).  Very few packages will need
> >   such code.  Indeed, both @file{install.R} and @file{R_PROFILE.R}
> >   should be viewed as experimental; the mechanism to execute code
> >   before attaching or installing the package may change in the near
> >   future.
> 
> > (Actually it's during loading, not attaching, a namespace, for packages
> > with namespaces.)
> 
> > Looking on CRAN, it seems that two packages use R_PROFILE.R for
> > `options(echo=FALSE)', which does not do anything useful AFAICS.  A
> > non-empty install.R is used for
> 
> > require(methods)
> > require(boot)
> > require("Hmisc")
> > data(Wcrit.R)
> 
> > and that's not the intention (and in particular require() should have its 
> > return value checked!) -- this is best done in .First.lib/.onLoad.
> 
> > One problem is that the package has no way to prevent a saved image being 
> > forced with INSTALL --save.
> 
> 
> > Since this mechanism is a maintenance nightmare (especially with
> > lazy-loading +/- saving images) I propose we drop it for 2.0.0.
> > Instead, just as for lazy-loading, we should have a field in the
> > DESCRIPTION file, with
> 
> > SaveImage: yes
> 
> > forcing saving the image, and any other value forcing not saving it.
> 
> Fine with me.
> 
> Can we perhaps agree to allow both yes/no and true/false for such
> logical package DESCRIPTION metadata (and also irrespective of case)?

I've allowed yes/Yes and no/No already.  I can fairly easily allow
true/false, but FaLSe is a little more difficult ....

It looks like Bioconductor has many examples so it will take longer to 
convert those.  The new mechanism is in place now, though.

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