|
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_USER
R_LIBS_USER=/R/R-libs/3.4h:/R/R_libs/3.5
R_LIBS_SITE
R_LIBS_SITE=/usr/lib/R/site-library:/usr/lib/R/library
.libPaths()
R_LIBS
:
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 p
ut it in a file named .REnviron
in your home HOME directory and use it as your private tree of installed libraries
R_LIBS=c:/R/mylibraries
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:
Sys.getenv
(
"R_LIBS"
)
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