[R] library() and lib.loc

Prof Brian D Ripley ripley at stats.ox.ac.uk
Fri Sep 28 09:03:29 CEST 2001

On Thu, 27 Sep 2001 r-help at lists.thewrittenword.com wrote:

(Really albert chin (china at thewrittenword.com): please sort out your
mailer so that mail gets sent back to you not redirected to the list!)

> library() takes lib.loc as the third argument. Where is this set? I am
> modifying the default library search path and everything seems to be
> ok except for this (I want R_HOME/lib/library rather than
> R_HOME/library).

Well, it isn't set, it is supplied by the user of library(), so just use

library(foo, lib.loc=file.path(Rhome(), "lib", "library"))

However, it defaults to .lib.loc, and that is set in the system Rprofile,
R_HOME/library/base/R/Rprofile.  The recommended way to change that is to
set R_LIBS before calling R, e.g. in your .Renviron.

You can't get away with changing the main library from R_HOME/library,
as that is hardcoded in several places.

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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list