summary.cranly_dependence_tree: summary method for 'cranly_dependence_tree' objects

View source: R/dependence_tree.R

summary.cranly_dependence_treeR Documentation

summary method for cranly_dependence_tree objects


Hard dependence summaries for R packages from a cranly_dependence_tree object


## S3 method for class 'cranly_dependence_tree'
summary(object, ...)



a cranly_dependence_tree object.


currently not used.


The summary method for a cranly_dependence_tree object returns the number of generations the R package(s) in the object inherit from (n_generations), the immediate parents of the R package(s) (parents), and a dependence index dependence_index defined as

-\frac{∑_{i \in C_p; i \ne p} \frac{1}{N_i} g_i}{∑_{i \in C_p; i \ne p} \frac{1}{N_i}}

where C_p is the dependence tree for the package(s) p, N_i is the total number of packages that depend, link or import package i, and g_i is the generation that package i appears in the dependence tree of package(s) p. The generation takes values on the non-positive integers, with the package(s) p being placed at generation 0, the packages that p links to, depends or imports at generation -1 and so on.

A dependence index of zero means that the p only has immediate parents. The dependence index weights the dependencies based on how popular these are, in the sense that the index is not penalized if the package depends on popular packages. The greatest the dependence index is the more baggage the package carries, and the maintainers may want to remove any dependencies that are not necessary.


A list with components n_generations, parents, and dependence_index.

See Also

build_dependence_tree.cranly_network() compute_dependence_tree()


cran_db <- clean_CRAN_db()
package_network <- build_network(cran_db)

## Two light packages
dep_tree <- build_dependence_tree(package_network, package = "brglm")

dep_tree <- build_dependence_tree(package_network, package = "gnm")

## A somewhat heavier package (sorry)...
dep_tree <- build_dependence_tree(package_network, package = "cranly")

cranly documentation built on Aug. 27, 2022, 1:07 a.m.