May the source be with you, but remember the KISS principle ;-)
Home Switchboard Unix Administration Red Hat TCP/IP Networks Neoliberalism Toxic Managers
(slightly skeptical) Educational society promoting "Back to basics" movement against IT overcomplexity and  bastardization of classic Unix

R_LIBS Directives

News Scripting languages Recommended Links R Environment Variables R_HOME R_LIBS .Renviron File .Rprofile file
R Packages CRAN package repository How to install R packages from local files R_installation on RHEL R help system Quotes Humor Etc

Both R_LIBS_USER and R_LIBS_SITE can specify multiple library paths, separated by colons (semicolons on Windows).

The value of R_LIBS is your provate R packages directory. You can put it  in a file named .REnviron  in your home HOME directory and use it as your private tree of installed libraries


From then on, you should be able to install packages into that location automatically, without having to fiddle around with .libPaths.

After setting this, install.packages() saves packages in the directory specified by R_LIBS. The location of this directory can be referred back to subsequently as follows:


All currently stored environment variables can be seen by calling Sys.getenv() with no arguments.

Note that many environment variables are already preset and do not need to be specified in .Renviron.

HOME, for example, which can be seen with Sys.getenv("HOME"), is taken from the operating systemís list of environment variables.

A list of the most important environment variables that can affect Rís behavior is documented in the  help page help("environment variables").

To set or unset an environment variable for the duration of a session, use the following commands:

Sys.setenv("TEST" = "test-string") # set an environment variable for the session
Sys.unsetenv("TEST") # unset it