libPaths
Search Paths for Packages
Description
.libPaths() lists or sets the paths containing packages.
Usage
.libPaths(new)
base::.Library
base::.Library.site
Arguments
new |
a character vector naming libraries (directories in which the library
function searches for add-on packages).
|
Details
If you supply a value for
new:
- Character strings specified by new
are passed through normalizePath to convert relative
paths to absolute paths, and to convert a possible initial tilde
to the user's home directory.
- The package search path is changed to
unique(c(new, base::.Library.site, base::.Library)).
- The new list of library directories is returned from the function.
- If new refers to an invalid path, the argument is ignored.
If you do not supply a value for
new, then the search path does not change,
and
.libPaths() just returns the current list of library directories.
.Library is a character string specifying the path of the
default library (R.home("library")).
.Library.site is a character vector specifying the locations
of site-specific libraries. Its default value, set when Spotfire Enterprise Runtime for R (TERR) starts a session,
is R.home("site-library"), but you can override it before you start TERR
by setting the environment variable TERR_LIBS_SITE
to a colon-separated (on Linux) or semicolon-separated (on Windows) list
of directories. Directories that do not exist at
startup time are silently omitted from .Library.site.
Neither .Library nor .Library.site can be changed after
a TERR session starts.
When TERR starts a session, it uses the values of Sys.getenv("TERR_LIBS")
and Sys.getenv("TERR_LIBS_USER") (treated as colon-separated or semicolon-separated
lists of directories) in a call to .libPaths(). TERR_LIBS_USER should
be considered a user-specific list of libraries for the current platform
and version of TERR, and it has the default value .expand_R_libs_env_var("\~/TERR/%p-library/%v").
TERR_LIBS should be considered as a session-specific list of libraries, and it
has no default value.
Value
returns a character vector of library directories in which TERR searches for packages.
Side Effects
If the function .libPaths is called with a value for the
new argument, the library search path is updated
so that subsequent calls to library or require
search new places for packages.
Examples
# list libraries.
.libPaths()
# add "~/packages" to front of list of libraries, if it names a directory.
.libPaths(c("~/packages", .libPaths()))