Re: [R] Local install of a contributed package under Linux (was: R-code for binormla distribution)

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Mon 03 Oct 2005 - 17:12:39 EST

On Sun, 2 Oct 2005, Jonathan Baron wrote:

> Try
>
> R CMD INSTALL -l lib pkgs
>
> The help file is in the utils package. I'm sure this is
> documented in the manual too.

But you still need to ensure that library() can find the packages.

I think the simplest way is that we have set up by default for new R users:

  1. Set the environment variable R_LIBS. For a site in R_HOME/etc/Renviron.site, or for a user in ~/.Renviron. For example, include the line

R_LIBS=~/R/library

2) Ensure that this directory exists, e.g.

mkdir -p ~/R/library

(If it does not exist the setting will be ignored, so it is safe to set it for all users.)

3) Use install.packages() inside R. This will by default use the first element in .libPaths(), which will be ~/R/library. Suggest to users that they use would do best to use

install.packages(pkgs, .libPaths()[1], dependencies = TRUE)

when they want to add packages, and update.packages(.libPaths()[1]) to update the packages they have installed.

Note that this works for Windows users too (although using ~ is perhaps dependent on setting HOME: our Windows default use the network drive P: instead).

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

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Mon Oct 03 18:12:32 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 18:09:35 EST