Skip to contents

This function uses renv::dependencies() to identify R package dependencies in a project and then calls pak::pkg_install() to install / update these packages. If some packages are not found, the function will install those available and returns a message indicated packages not installed/updated.

Usage

install_dependencies(
  dependencies = NULL,
  ask = TRUE,
  dev = FALSE,
  engine = c("utils", "pak")
)

Arguments

dependencies

An optional list of dependencies. If NULL, will be determined with renv::dependencies(). If equal to "old", will use the list returned by utils::old.packages().

ask

Whether to ask for confirmation when installing a different version of a package that is already installed. Installations that only add new packages never require confirmation.

dev

If TRUE, install required dependencies plus optional and development dependencies. If FALSE, install only required dependencies.

engine

If "utils", uses utils::install.packages() (on Linux could be useful if using #' bspm or CoprManager). If "pak", uses pak::pkg_install().

Value

(Invisibly) A data frame with information about the installed package(s) or a vector with the list of installed packages.

Examples

if (FALSE) { # \dontrun{
install_dependencies()
} # }