Prof Brian Ripley writes:
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
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)?