packrat-external: Managing External Libraries

packrat-externalR Documentation

Managing External Libraries

Description

These functions provide a mechanism for (temporarily) using packages outside of the packrat private library. The packages are searched within the 'default' libraries; that is, the libraries that would be available upon launching a new R session.

Usage

with_extlib(packages = NULL, expr, envir = parent.frame())

extlib(packages)

user_lib()

packrat_lib()

Arguments

packages

An optional set of package names (as a character vector) to load for the duration of evaluation of expr. Whether packages is provided or NULL (the default), expr is evaluated in an environment where the external library path is in place, not the local (packrat) library path.

expr

An R expression.

envir

An environment in which the expression is evaluated.

Examples

## Not run: 
with_extlib("lattice", xyplot(1 ~ 1))
with_extlib(expr = packageVersion("lattice"))
# since devtools requires roxygen2 >= 5.0.0 for this step, this
# should fail unless roxygen2 is available in the packrat lib.loc
with_extlib("devtools", load_all("path/to/project"))
# this method will work given roxygen2 is installed in the
# non-packrat lib.loc with devtools
with_extlib(expr = devtools::load_all("path/to/project"))

## End(Not run)

packrat documentation built on Sept. 8, 2023, 5:44 p.m.