[Rd] installing packages

Prof Brian Ripley
Mon, 01 Dec 2003 08:25:39 -0000

On Sun, 30 Nov 2003, Jan de Leeuw wrote:

> If R_LIBS is not set then R CMD INSTALL without a lib argument installs
> in R_HOME/library
> while install.packages() without lib installs in the first element of
> .libPaths().

which would normally be .Library=R_HOME/library, set in Rprofile.

> If R_LIBS is set, then R CMD INSTALL installs in the
> first directory in R_LIBS, and install.packages() still installs in the
> first element
> of .libPaths() (i.e. ignores R_LIBS).

The first element of .libPaths() should be the first element of R_LIBS by
default, set in Rprofile.

> Is this difference intentional ? It would perhaps be more convenient if
> .libPaths()[1] was used as a default in all cases (when no lib argument
> is given).

It is, provided the user has not reset .libPaths.

One caveat: R CMD INSTALL looks for R_LIBS in the environment, whereas by
the time .libPaths() is set it can be set in other places, including via
~/.Renviron.  Maybe R CMD INSTALL should look at more of those places.


--
Brian D. Ripley,                  ripley@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