Rev 41341 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{libPaths}\title{Search Paths for Packages}\alias{.Library}\alias{.Library.site}\alias{.libPaths}\alias{R_LIBS}\alias{R_LIBS_SITE}\alias{R_LIBS_USER}\alias{.expand_R_libs_env_var}\description{\code{.libPaths} gets/sets the library trees within which packages arelooked for.}\usage{.libPaths(new).Library.Library.site}\arguments{\item{new}{a character vector with the locations of \R librarytrees. Tilde expansion (\code{\link{path.expand}}) is done, and ifany element contains one of \code{*?[}, globbing is done wheresupported by the platform: see \code{\link{Sys.glob}}.}}\details{\code{.Library} is a character string giving the location of thedefault library, the \file{library} subdirectory of \env{R\_HOME}.\code{.Library.site} is a (possibly empty) character vector giving thelocations of the site libraries, by default the \file{site-library}subdirectory of \env{R\_HOME} (which may not exist).\code{.libPaths} is used for getting or setting the library trees that\R knows about (and hence uses when looking for packages). If calledwith argument \code{new}, the library search path is set tothe existing directories in \code{unique(c(new, .Library.site, .Library))}and this is returned. If given no argument, a character vector withthe currently active library trees is returned.#ifdef unixThe library search path is initialized at startup from the environmentvariable \env{R\_LIBS} (which should be a colon-separated list ofdirectories at which \R library trees are rooted) followed by those inenvironment variable \env{R\_LIBS\_USER}. Only directories which existat the time will be included.By default \env{R\_LIBS} is unset, and \env{R\_LIBS\_USER} is set todirectory \file{R/\var{R.version\$platform}-library/\var{x.y}}of the home directory, for \R \var{x.y.z}.\code{.Library.site} can be set via the environment variable\env{R\_LIBS\_SITE} (as a colon-separated list of library trees).#endif#ifdef windowsThe library search path is initialized at startup from the environmentvariable \env{R\_LIBS} (which should be a semicolon-separated list ofdirectories at which \R library trees are rooted) followed by those inenvironment variable \env{R\_LIBS\_USER}. Only directories which existat the time will be included.By default \env{R\_LIBS} is unset, and \env{R\_LIBS\_USER} is set tosubdirectory \file{R/win-library/\var{x.y}} of the home directory,for \R \var{x.y.z}.\code{.Library.site} can be set via the environment variable\env{R\_LIBS\_SITE} (as a semicolon-separated list of library trees).#endifBoth \env{R\_LIBS\_USER} and \env{R\_LIBS\_SITE} feature possibleexpansion of specifiers for \R version specific information as part ofthe startup process. The possible conversion specifiers all startwith a \samp{\%} and are followed by a single letter (use \samp{\%\%}to obtain \samp{\%}), with currently available conversionspecifications as follows:\describe{\item{\code{\%V}}{\R version number including the patchlevel (e.g.,\samp{2.5.0}).}\item{\code{\%v}}{\R version number excluding the patchlevel (e.g.,\samp{2.5}).}\item{\code{\%p}}{the platform for which \R was built.}\item{\code{\%o}}{the underlying operating system.}\item{\code{\%a}}{the architecture (CPU) \R was built on/for.}}(See \code{\link{version}} for details on R version information.)Function \code{.libPaths} always uses the values of \code{.Library}and \code{.Library.site} in the base name space. \code{.Library.site}can be set by the site in \file{Rprofile.site}, which should befollowed by a call to \code{.libPaths(.libPaths())} to make use of theupdated value.}\value{A character vector of file paths.}\references{Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)\emph{The New S Language}.Wadsworth \& Brooks/Cole.}\seealso{\code{\link{library}}}\examples{.libPaths() # all library trees R knows about}\keyword{data}