EVOLUTION-MANAGER
Edit File: find.package.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: Find 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 find.package {base}"><tr><td>find.package {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Find Packages</h2> <h3>Description</h3> <p>Find the paths to one or more packages. </p> <h3>Usage</h3> <pre> find.package(package, lib.loc = NULL, quiet = FALSE, verbose = getOption("verbose")) path.package(package, quiet = FALSE) packageNotFoundError(package, lib.loc, call = NULL) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>package</code></td> <td> <p>character vector: the names of packages.</p> </td></tr> <tr valign="top"><td><code>lib.loc</code></td> <td> <p>a character vector describing the location of <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> library trees to search through, or <code>NULL</code>. The default value of <code>NULL</code> corresponds to checking the loaded namespace, then all libraries currently known in <code><a href="libPaths.html">.libPaths</a>()</code>.</p> </td></tr> <tr valign="top"><td><code>quiet</code></td> <td> <p>logical. Should this not give warnings or an error if the package is not found?</p> </td></tr> <tr valign="top"><td><code>verbose</code></td> <td> <p>a logical. If <code>TRUE</code>, additional diagnostics are printed, notably when a package is found more than once.</p> </td></tr> <tr valign="top"><td><code>call</code></td> <td> <p>call expression.</p> </td></tr> </table> <h3>Details</h3> <p><code>find.package</code> returns path to the locations where the given packages are found. If <code>lib.loc</code> is <code>NULL</code>, then loaded namespaces are searched before the libraries. If a package is found more than once, the first match is used. Unless <code>quiet = TRUE</code> a warning will be given about the named packages which are not found, and an error if none are. If <code>verbose</code> is true, warnings about packages found more than once are given. For a package to be returned it must contain a either a ‘<span class="file">Meta</span>’ subdirectory or a ‘<span class="file">DESCRIPTION</span>’ file containing a valid <code>version</code> field, but it need not be installed (it could be a source package if <code>lib.loc</code> was set suitably). </p> <p><code>find.package</code> is not usually the right tool to find out if a package is available for use: the only way to do that is to use <code><a href="library.html">require</a></code> to try to load it. It need not be installed for the correct platform, it might have a version requirement not met by the running version of <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span>, there might be dependencies which are not available, .... </p> <p><code>path.package</code> returns the paths from which the named packages were loaded, or if none were named, for all currently attached packages. Unless <code>quiet = TRUE</code> it will warn if some of the packages named are not attached, and given an error if none are. </p> <p><code>packageNotFoundError</code> creates an error condition object of class <code>packageNotFoundError</code> for signaling errors. The condition object contains the fields <code>package</code> and <code>lib.loc</code>. </p> <h3>Value</h3> <p>A character vector of paths of package directories. </p> <h3>See Also</h3> <p><code><a href="path.expand.html">path.expand</a></code> and <code><a href="normalizePath.html">normalizePath</a></code> for path standardization. </p> <h3>Examples</h3> <pre> try(find.package("knitr")) ## will not give an error, maybe a warning about *all* locations it is found: find.package("kitty", quiet=TRUE, verbose=TRUE) ## Find all .libPaths() entries a package is found: findPkgAll <- function(pkg) unlist(lapply(.libPaths(), function(lib) find.package(pkg, lib, quiet=TRUE, verbose=FALSE))) findPkgAll("MASS") findPkgAll("knitr") </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>