Get package dependencies
getDependencies(
pkgs,
dependencies = c("Depends", "Imports", "LinkingTo"),
installed = TRUE,
available = TRUE,
base = FALSE,
recommended = FALSE
)
A character vector of package names.
character vector of package names
character vector of dependency types to include.
Choices are "Depends", "Imports", "LinkingTo", "Suggests", and "Enhances".
Defaults to c("Depends", "Imports", "LinkingTo")
.
Logical indicating whether to pull dependency information from installed packages. Defaults to TRUE.
Logical indicating whether to pull dependency information from available packages. Defaults to TRUE.
Logical indicating whether to include dependencies on base packages that are included in the R installation. Defaults to FALSE.
Logical indicating whether to include dependencies on recommended packages that are included in the R installation. Defaults to FALSE.
Gregory R. Warnes greg@warnes.net based on the non exported
utils:::getDependencies
and utils:::.clean_up_dependencies2
.
This function recursively constructs the list of dependencies for the
packages given by pkgs
. By default, the dependency information is
extracted from both installed and available packages. As a consequence, it
works both for local and CRAN packages.
if (FALSE) {
## A locally installed package
#' getDependencies("MASS", installed = TRUE, available = FALSE)
## A package on CRAN
getDependencies("gregmisc", installed = FALSE, available = TRUE)
## Show base and recommended dependencies
getDependencies("MASS", available = FALSE, base = TRUE, recommended = TRUE)
## Download the set of packages necessary to support a local package
deps <- getDependencies("MyLocalPackage", available = FALSE)
download.packages(deps, destdir = "./R_Packages")
}
Run the code above in your browser using DataLab