Learn R Programming

RWsearch (version 4.7.0)

p_deps: Dependencies and Reverse Dependencies of Packages

Description

p_deps returns the (reverse) dependencies of a (vector of) package(s). It is a wrapper of the tools::package_dependencies function. A warning is issued for packages that are not in crandb + .libPaths() (for instance in CRAN archive, Bioconductor, Github or your own directories).

p_depsrev is a shortcut to p_deps(reverse = TRUE). It returns the reverse dependencies (e.g. the children packages).

p_network returns the package dependencies as a network of nodes and links. It is called by n_graphF and n_graphS.

p_deps_inpkgs returns the package dependencies that are installed in the computer.

p_deps_unpkgs returns the package dependencies that are not installed in the computer.

p_deps_inun combines p_deps and p_inun_crandb, then returns the status of all dependencies: installed or not installed in the computer, available or not available in the current crandb (see CRAN archives, Bioconductor, Github, your own packages).

The missing packages available on CRAN can be downloaded with p_down0, downloaded and checked (by R CMD check) with xfun::rev_check or installed with install.packages. The packages removed from CRAN but available in CRAN archive can be downloaded with p_downarch.

Usage

p_deps(..., char = NULL, which = "DIL", recursive = FALSE,
  reverse = FALSE, verbose = getOption("verbose"),
  crandb = get("crandb", envir = .GlobalEnv))

p_depsrev(..., char = NULL, which = "DIL", recursive = FALSE, reverse = FALSE, verbose = getOption("verbose"), crandb = get("crandb", envir = .GlobalEnv))

p_network(..., char = NULL, which = "DIL", recursive = TRUE, reverse = FALSE, exclpkgs = TRUE, crandb = get("crandb", envir = .GlobalEnv))

p_deps_inpkgs(..., char = NULL, which = "DIL", recursive = TRUE, reverse = FALSE, verbose = FALSE, crandb = get("crandb", envir = .GlobalEnv))

p_deps_unpkgs(..., char = NULL, which = "DIL", recursive = TRUE, reverse = FALSE, verbose = FALSE, crandb = get("crandb", envir = .GlobalEnv))

p_deps_inun(..., char = NULL, which = "DIL", recursive = TRUE, reverse = FALSE, verbose = FALSE, crandb = get("crandb", envir = .GlobalEnv))

Arguments

...

any format recognized by cnsc, excluding list. A package or a vector of packages listed in crandb or in installed.packages().

char

(name to) a character vector. Use this argument if ... fails or if you call the function from another function. If used, argument ... is ignored.

which

character vector. A sub-vector of c("Depends", "Imports", "LinkingTo", "Suggests", "Enhances"). The short forms "D", "I", "L", "S", "N", "DL", "DI", "DIL", "DILS", "DILN", "DILSN", "SN" are accepted. "N" is for "Enhances" as the single letter "E" is used by R as a shortcut to EXPR, a reserved word.

recursive

logical. Search for (reverse) dependencies of (reverse) dependencies.

reverse

logical. Search for reverse dependencies.

verbose

logical. Returns additional information about the search.

crandb

data.frame crandb. Also accepted is NULL which will search in the local installed.packages(). This later form allows (private) packages that are not listed in crandb.

exclpkgs

logical or character vector. TRUE excludes from the network of nodes and links the dependencies c("graphics", "grDevices", "methods", "stats", "tools", "utils"). FALSE includes them. You can provide your own vector of packages to exclude them from the network of nodes and links.

Examples

Run this code
# NOT RUN {
## In real life, download crandb from CRAN or load it from your directory 
## with functions crandb_down() or crandb_load(). 
## In this example, we use a small file.
crandb_load(system.file("data", "zcrandb.rda", package = "RWsearch"))

p_deps(canprot, FatTailsR) 
p_deps(canprot, FatTailsR, recursive = TRUE)
p_deps(canprot, FatTailsR, recursive = TRUE, which = "DIL")
p_deps(actuar, reverse = TRUE, which = "DILSN")

p_network(canprot, exclpkgs = FALSE)

p_deps_inpkgs(RWsearch, canprot)
p_deps_unpkgs(RWsearch, canprot)
p_deps_inun(RWsearch, canprot, donotexist)

# }

Run the code above in your browser using DataLab