Skip to contents

Install packages from Bioconductor, CRAN, or a Git remote

Usage

install(
  pkgs,
  lib = .libPaths()[[1L]],
  dependencies = NA,
  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().

lib

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

dependencies

logical(1), character, or NA.

  • TRUE/FALSE indicating whether to install uninstalled packages which these packages depend on/link to/import/suggest.

  • Can pass a character vector, a subset of c("Depends", "Imports", " LinkingTo", "Suggests", "Enhances").

  • Can pass NA, the default for install.packages(), which means c("Depends", "Imports", "LinkingTo").

type

character(1). Type of package to download and install: "binary", "source", or "both" (prefer binary but fall back to source).

reinstall

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

Value

Invisible list. Contains information on pkgs and lib defined.

Note

Updated 2023-05-17.

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)