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

Description

Hard dependence summaries for R packages from a cranly_dependence_tree object

Usage

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

Arguments

object

a cranly_dependence_tree object.

...

currently not used.

Details

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.

Value

A list with components n_generations, parents, and dependence_index.

See Also

build_dependence_tree.cranly_network() compute_dependence_tree()

Examples


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

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

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

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




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