cached_install: Install and/or load a version of a package

Description Usage Arguments Details Value Examples

Description

cached_install checks the package cache, installs the specified version if it is not already installed, and loads the versioned package namespace.

Usage

1
2
cached_install(package, version, return = c("namespace", "path"),
  cache = TRUE, quiet = TRUE, partial = TRUE, ...)

Arguments

package

Package name.

version

Version as a character string.

return

Return the file "path" to the installed package, or the "namespace" object?

cache

If FALSE, always reinstall the package.

quiet

Logical. Try to minimize output from package installation. (Some output comes from R CMD INSTALL and may be unavoidable.)

partial

Default TRUE. Passed to loadNamespace().

...

Arguments passed to versions::install.versions() or remotes::install_version(), and thence to install.packages(). Ncpus may be useful.

Details

If the package is already loaded, cached_install will first attempt to unload it with a warning. This may not always work!

Note that the namespace is not attached. Partial loading is faster and safer when you are (un)loading multiple versions, but does not export functions etc.

Value

The namespace object or directory where the package is installed.

Examples

1
2
3
4
## Not run: 
cached_install("clipr", "0.4.0")

## End(Not run)

hughjonesd/apicheck documentation built on Sept. 9, 2019, 12:55 p.m.