p_graph: Network and Graphs of Package Dependencies

p_graphR Documentation

Network and Graphs of Package Dependencies

Description

p_graphF calculates the (recursive/reverse) dependencies of a (vector of) package(s) and displays in the default browser a standard graph (F/Force in the networkD3 terminology) of the package dependencies. It combines the p_network and n_graphF functions.

p_graphF calculates the (recursive/reverse) dependencies of a (vector of) package(s) and displays in the default browser a Sankey graph (in the networkD3 terminology) of the package dependencies. It combines the p_network and n_graphS functions.

p_network returns the (recursive/reverse) dependencies of a (vector of) package(s) as a network of nodes and links.

n_graphF taks as input a network of package nodes and links and displays them in the default browser as a standard graph (F/Force in the networkD3 terminology) representing the package dependencies.

n_graphF taks as input a network of package nodes and links and displays them in the default browser as a Sankey graph (in the networkD3 terminology) representing the package dependencies.

Remember that the option exclpkgs = ... whose default value TRUE is equivalent to exclpkgs = c("graphics", "grDevices", "methods", "stats", "tools", "utils"), can substantially modify the aspect of the graph, especially for reverse = FALSE.

Usage

p_graphF(..., char = NULL, which = "DIL", recursive = TRUE,
  reverse = FALSE, exclpkgs = TRUE, group = 2, fontFamily = "serif",
  fontSize = 11, linkDistance = 50, charge = -100,
  crandb = get("crandb", envir = .GlobalEnv))

p_graphS(..., char = NULL, which = "DIL", recursive = TRUE,
  reverse = FALSE, exclpkgs = TRUE, group = 2, fontFamily = "serif",
  fontSize = 14, nodeWidth = 30, nodePadding = 10,
  crandb = get("crandb", envir = .GlobalEnv))

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

n_graphF(netw, group = 2, fontFamily = "serif", fontSize = 11,
  linkDistance = 50, charge = -100)

n_graphS(netw, group = 2, fontFamily = "serif", fontSize = 14,
  nodeWidth = 30, nodePadding = 10)

Arguments

...

any format recognized by cnsc. Lists are accepted for p_graphF and p_graphS (and will result in multiple html pages) but not in p_network. A vector or a list of package(s) 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.

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, for instance: exclpkgs = c("ggplot2", list.files(.Library)).

group

integer, currently 1, 2 or 3. The suffix of the "NGroup" column in netw. Define a scheme for colouring the nodes.

fontFamily

character. Either "serif" or "sans-serif".

fontSize

integer. The size of the font.

linkDistance

integer. The minimal distance of a link between two nodes.

charge

integer. A repulsive value between two nodes.

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.

nodeWidth

integer. The width of the rectangular nodes in the Sankey graph.

nodePadding

integer. The vertical space between two nodes in the same column of a Sankey graph.

netw

a list of class "pkgsnetwork" produced by p_network that describes the dependencies of one or several packages with nodes and links (a network).

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"))

lst  <- list("RWsearch", "visNetwork") ; lst
netw <- p_network(actuar, fitdistrplus, reverse = TRUE) ; netw

if (interactive()) {
p_graphF(lst)
p_graphS(RWsearch, visNetwork)

n_graphF(netw)
n_graphS(netw)
}

RWsearch documentation built on March 18, 2022, 5:17 p.m.