EVOLUTION-MANAGER
Edit File: libPaths.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Search Paths for Packages</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for libPaths {base}"><tr><td>libPaths {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Search Paths for Packages</h2> <h3>Description</h3> <p><code>.libPaths</code> gets/sets the library trees within which packages are looked for. </p> <h3>Usage</h3> <pre> .libPaths(new) .Library .Library.site </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>new</code></td> <td> <p>a character vector with the locations of <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> library trees. Tilde expansion (<code><a href="path.expand.html">path.expand</a></code>) is done, and if any element contains one of <code>*?[</code>, globbing is done where supported by the platform: see <code><a href="Sys.glob.html">Sys.glob</a></code>.</p> </td></tr> </table> <h3>Details</h3> <p><code>.Library</code> is a character string giving the location of the default library, the ‘<span class="file">library</span>’ subdirectory of <span class="env">R_HOME</span>. </p> <p><code>.Library.site</code> is a (possibly empty) character vector giving the locations of the site libraries, by default the ‘<span class="file">site-library</span>’ subdirectory of <span class="env">R_HOME</span> (which may not exist). </p> <p><code>.libPaths</code> is used for getting or setting the library trees that <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> knows about (and hence uses when looking for packages). If called with argument <code>new</code>, the library search path is set to the existing directories in <code>unique(c(new, .Library.site, .Library))</code> and this is returned. If given no argument, a character vector with the currently active library trees is returned. </p> <p>How paths <code>new</code> with a trailing slash are treated is OS-dependent. On a POSIX filesystem existing directories can usually be specified with a trailing slash: on Windows filepaths with a trailing slash (or backslash) are invalid and so will never be added to the library search path. </p> <p>The library search path is initialized at startup from the environment variable <span class="env">R_LIBS</span> (which should be a colon-separated list of directories at which <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> library trees are rooted) followed by those in environment variable <span class="env">R_LIBS_USER</span>. Only directories which exist at the time will be included. </p> <p>By default <span class="env">R_LIBS</span> is unset, and <span class="env">R_LIBS_USER</span> is set to directory ‘<span class="file">R/<var>R.version$platform</var>-library/<var>x.y</var></span>’ of the home directory (or ‘<span class="file">Library/R/<var>x.y</var>/library</span>’ for CRAN macOS builds), for <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> <var>x.y.z</var>. </p> <p><code>.Library.site</code> can be set via the environment variable <span class="env">R_LIBS_SITE</span> (as a non-empty colon-separated list of library trees). </p> <p>Both <span class="env">R_LIBS_USER</span> and <span class="env">R_LIBS_SITE</span> feature possible expansion of specifiers for <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> version specific information as part of the startup process. The possible conversion specifiers all start with a <span class="samp">%</span> and are followed by a single letter (use <span class="samp">%%</span> to obtain <span class="samp">%</span>), with currently available conversion specifications as follows: </p> <dl> <dt><span class="samp">%V</span></dt><dd><p><span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> version number including the patchlevel (e.g., <span class="samp">2.5.0</span>).</p> </dd> <dt><span class="samp">%v</span></dt><dd><p><span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> version number excluding the patchlevel (e.g., <span class="samp">2.5</span>).</p> </dd> <dt><span class="samp">%p</span></dt><dd><p>the platform for which <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> was built, the value of <code><a href="Version.html">R.version</a>$platform</code>.</p> </dd> <dt><span class="samp">%o</span></dt><dd><p>the underlying operating system, the value of <code><a href="Version.html">R.version</a>$os</code>.</p> </dd> <dt><span class="samp">%a</span></dt><dd><p>the architecture (CPU) <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> was built on/for, the value of <code><a href="Version.html">R.version</a>$arch</code>.</p> </dd> </dl> <p>(See <code><a href="Version.html">version</a></code> for details on R version information.) </p> <p>Function <code>.libPaths</code> always uses the values of <code>.Library</code> and <code>.Library.site</code> in the base namespace. <code>.Library.site</code> can be set by the site in ‘<span class="file">Rprofile.site</span>’, which should be followed by a call to <code>.libPaths(.libPaths())</code> to make use of the updated value. </p> <p>For consistency, the paths are always normalized by <code><a href="normalizePath.html">normalizePath</a>(winslash = "/")</code>. </p> <h3>Value</h3> <p>A character vector of file paths. </p> <h3>References</h3> <p>Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) <em>The New S Language</em>. Wadsworth & Brooks/Cole. </p> <h3>See Also</h3> <p><code><a href="library.html">library</a></code> </p> <h3>Examples</h3> <pre> .libPaths() # all library trees R knows about </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>