p_deps: Dependencies and Reverse Dependencies of Packages

p_depsR Documentation

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_depsrec is a shortcut to p_deps(recursive = TRUE). It returns the recursive dependencies (e.g. the list of all ancestors).

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

p_deps_deps returns a list with the recursive dependencies for the packages packages and every first level dependencies (including or excluding the ones in .Library.

p_deps_ndeps returns a vector of the number of dependencies for each package and their parent dependencies. With the argument sort = TRUE, the packages are listed from no dependency to the largest number of dependencies.

p_deps_count counts the number of (recursive/reverse) dependencies for each package and returns a data.frame with 4 columns: Parents1, ParentsN, Children1, ChildrenN.

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 = TRUE, crandb = get("crandb", envir =
  .GlobalEnv))

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

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

p_deps_deps(..., char = NULL, which = "DIL", Library = FALSE,
  verbose = TRUE, crandb = get("crandb", envir = .GlobalEnv))

p_deps_ndeps(..., char = NULL, which = "DIL", Library = FALSE,
  sort = TRUE, verbose = TRUE, crandb = get("crandb", envir =
  .GlobalEnv))

p_deps_count(..., char = NULL, which = "DIL", verbose = TRUE,
  crandb = get("crandb", envir = .GlobalEnv))

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

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

p_deps_inun(..., char = NULL, which = "DIL", recursive = TRUE,
  reverse = 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. Print the message.

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.

Library

logical. The default FALSE excludes the base and recommended packages stored in .Library. TRUE includes them.

sort

logical. The default TRUE sorts the package by the number of dependencies.

Examples

## 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(networkD3, visNetwork)
p_deps(networkD3, visNetwork, recursive = TRUE)
p_deps(actuar, fitdistrplus, reverse = TRUE, which = "DILSN")

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

p_deps_deps(actuar, networkD3, FatTailsR, RWsearch, NotApkg)
p_deps_ndeps(actuar, networkD3, FatTailsR, RWsearch, NotApkg)
p_deps_count(actuar, networkD3, FatTailsR, RWsearch, NotApkg)


RWsearch documentation built on May 29, 2024, 6:42 a.m.