Learn R Programming

renv (version 0.9.3)

install: Install Packages

Description

Install one or more R packages from a variety of remote sources.

Usage

install(
  packages = NULL,
  ...,
  library = NULL,
  rebuild = FALSE,
  confirm = interactive(),
  project = NULL
)

Arguments

packages

A character vector of R packages to install. Required package dependencies (Depends, Imports, LinkingTo) will be installed as required.

...

Unused arguments, reserved for future expansion. If any arguments are matched to ..., renv will signal an error.

library

The R library to be used. When NULL, the active project library will be used instead.

rebuild

Force packages to be rebuilt, thereby bypassing any installed versions of the package available in the cache? This can either be a boolean (indicating that the requested package(s) should be rebuilt), or a vector of package names indicating which packages should be rebuilt.

confirm

Boolean; prompt the user before taking any action?

project

The project directory. If NULL, then the active project will be used. If no project is currently active, then the current working directory is used instead.

Value

A named list of package records which were installed by renv.

Details

install() uses the same machinery as restore() when installing packages. In particular, this means that the local cache of package installations is used when possible. This helps to avoid re-downloading packages that have already been downloaded before, and re-compiling packages from source when a binary copy of that package is already available.

Note that this interface is subject to change -- the goal is to hook into separate package installation backends in the future.

Examples

Run this code
# NOT RUN {
# install the latest version of 'digest'
renv::install("digest")

# install an old version of 'digest' (using archives)
renv::install("digest@0.6.18")

# install 'digest' from GitHub (latest dev. version)
renv::install("eddelbuettel/digest")

# install a package from local sources
renv::install("~/path/to/package")

# }

Run the code above in your browser using DataLab