package_dependencies {tools} | R Documentation |
Computations on the Dependency Hierarchy of Packages
Description
Find (recursively) dependencies or reverse dependencies of packages.
Usage
package_dependencies(packages = NULL, db = NULL,
which = c("Depends", "Imports", "LinkingTo"),
recursive = FALSE, reverse = FALSE, verbose = getOption("verbose"))
Arguments
packages |
a character vector of package names. |
db |
character matrix as from |
which |
a character vector listing the types of
dependencies, a subset of
|
recursive |
logical: should (reverse) dependencies of (reverse) dependencies (and so on) be included? |
reverse |
logical: if |
verbose |
logical indicating if output should monitor the package search cycles. |
Value
Named list with one element for each package in argument packages
,
each consists of a character vector naming the (recursive) (reverse) dependencies
of that package.
For given packages which are not found in the db, NULL
entries are returned,
as opposed to character(0)
entries which indicate no dependencies.
See Also
dependsOnPkgs
, and package.dependencies
for checking
dependencies.
Examples
myPkgs <- c("MASS", "Matrix", "KernSmooth", "class", "cluster", "codetools")
pdb <- available.packages()
system.time(
dep1 <- package_dependencies(myPkgs, db = pdb) # all arguments at default
) # very fast
utils::str(dep1, vec.len=10)
system.time( ## reverse dependencies, recursively --- takes much longer:
deps <- package_dependencies(myPkgs, db = pdb,
which = c("Depends", "Imports", "LinkingTo", "Suggests"),
recursive = TRUE, reverse = TRUE)
) # seen ~ 10 seconds
lengths(deps) # 2015-01-14: all are 7040, but codetools with 7046