Install packages from Bioconductor, CRAN, or a Git remote

install(
  pkgs,
  configureArgs = getOption("configure.args"),
  configureVars = getOption("configure.vars"),
  autoconf = TRUE,
  dependencies = TRUE,
  lib = .libPaths()[[1L]],
  type = getOption("pkgType", default = "source"),
  reinstall = TRUE
)

Arguments

pkgs

character. Package names to install. By default, strings are passed to BiocManager::install().

Special cases:

  • Package tarball files and remote URLs (i.e. from CRAN or Bioconductor) are supported.

  • Strings matching "USER/REPO" are treated as GitHub repositories, and installed using remotes::install_github().

  • Strings ending with ".git" are treated as Git repositories, and installed using remotes::install_git().

configureArgs, configureVars

character or named list. Used only for source installs. If a character vector with no names is supplied, the elements are concatenated into a single string (separated by a space) and used as the value for the --configure-args or configure-vars flag in the call to R CMD INSTALL. If the character vector has names, these are assumed to identify values for --configure-args or --configure-vars for individual packages. This allows one to specify settings for an entire collection of packages which will be used if any of those packages are to be installed.

A named list can be used also to the same effect, and that allows multi-element character strings for each package which are concatenated to a single string to be used as the value for --configure-args and/or --configure-vars.

autoconf

logical(1). Smartly Set configuration options internally automatically for some packages that are problematic to install from source. Note that this will override configureArgs and configureVars settings, when applicable. Currently applies to: rgl.

dependencies

logical(1), character, or NA.

lib

character. Destination library directory path. Defaults to the first element of .libPaths().

type

character(1). Type of package to download and install. "source" is recommended by default, but "binary" can be used on macOS or Windows to install pre-built binaries from CRAN or Bioconductor.

Note that installing from source requires the correct GCC and GNU Fortran binaries to be installed, and Apple LLVM/Clang compilers should not be used on macOS. Refer to macOS development tools for details.

reinstall

logical(1). Force reinstallation of any existing packages.

Value

Invisible list. Contains information on pkgs and lib defined.

Note

Updated 2021-08-22.

Examples

## > testlib <- file.path(tempdir(), "testlib") ## > unlink(testlib, recursive = TRUE) ## > out <- install( ## > pkgs = "BiocGenerics", ## > dependencies = FALSE, ## > lib = file.path(tempdir(), "testlib") ## > ) ## > print(out) ## > list.dirs(path = testlib, full.names = FALSE, recursive = FALSE) ## > unlink(testlib, recursive = TRUE)