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

From: Prof Brian Ripley <>
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/, or for a user in ~/.Renviron. For example, include the line


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,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ mailing list
PLEASE do read the posting guide!
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