[R] is it possible to install R packages without admin rights on a work station
Rolf Turner
rolf.turner at xtra.co.nz
Mon Sep 16 10:46:17 CEST 2013
On 09/16/13 19:01, Charles Thuo wrote:
> How can a person in a controlled environment install additional R
> packages...
Use a "local library" in your user space. Create a directory --- I
called mine "Rlib",
and it is located in my home directory. I.e. my local library is
/home/rolf/Rlib.
Then when using install.packages() from within R I invoke the function with
the syntax
install.packages("<whatever>",lib="/home/rolf/Rlib",<other possible
arguments>)
Installing from source, from the command line I do:
R CMD INSTALL <whatever>.tar.gz -l /home/rolf/Rlib
To load a package from one's local library one can do things like:
library(<whatever>,lib.loc="/home/rolf/Rlib")
Note that the argument specifying the local library is named "lib" in
install.packages()
but is named "lib.loc" in library(). I can never remember which is
which. Psigh!
Or you can add your local library to your .libPaths(), as in:
.libPaths("/home/rolf/Rlib")
You can put a line like this in your .Rprofile file so that it gets done
automatically
when you start R. Or you can set an environment variable R_LIBS:
setenv R_LIBS /home/rolf/Rlib
(if using csh) or
R_LIBS = /home/rolf/Rlib
export R_LIBS
(if using bash).
HTH
cheers,
Rolf Turner
More information about the R-help
mailing list