Tuesday, March 14, 2006

Install R Packages On Linux Without Changing Permissions For Users

Typically, R installs packages /usr/lib/R/library/; other locations can be added using the R_LIBS environment variable in a Linux environment. If R_LIBS is null, R defaults to /usr/lib/R/library/

To change R_LIBS
export R_LIBS=/somefolder/
To check whether the variable was changed
echo $R_LIBS
Restart R to ensure that the packages in the alternative location are read. Packages installed in this fashion must be the Windows binary version of the package and must be unzipped into the directory. The library() command is used in the normal fashion.
library(somepackage)
This will only work for the current Linux session. To make the change permanent the export R_LIBS command can be placed in .bash_profile.

No comments: