pkgDepMetrics: Report package dependency burden

View source: R/pkgDependencyMetrics.R

pkgDepMetricsR Documentation

Report package dependency burden

Description

Elaborate a report on the dependency burden of a given package.

Usage

pkgDepMetrics(pkg, depdf)

Arguments

pkg

character() name of the package for which we want to obtain metrics on its dependency burden.

depdf

a tidy data frame with package dependency information obtained through the function buildPkgDependencyDataFrame.

Value

A tidy data frame with different metrics on the package dependency burden. More concretely, the following columns:

  • ImportedAndUsed: number of functionality calls imported and used in the package.

  • Exported: number of functionality calls exported by the dependency.

  • Usage: (ImportedAndUsedx 100) / Exported. This value provides an estimate of what fraction of the functionality of the dependency is actually used in the given package.

  • DepOverlap: Similarity between the dependency graph structure of the given package and the one of the dependency in the corresponding row, estimated as the Jaccard index between the two sets of vertices of the corresponding graphs. Its values goes between 0 and 1, where 0 indicates that no dependency is shared, while 1 indicates that the given package and the corresponding dependency depend on an identical subset of packages.

  • DepGainIfExcluded: The 'dependency gain' (decrease in the total number of dependencies) that would be obtained if this package was excluded from the list of direct dependencies.

The reported information is ordered by the Usage column to facilitate the identification of dependencies for which the analyzed package is using a small fraction of their functionality and therefore, it could be easier remove them. To aid in that decision, the column DepOverlap reports the overlap of the dependency graph of each dependency with the one of the analyzed package. Here a value above, e.g., 0.5, could, albeit not necessarily, imply that removing that dependency could substantially lighten the dependency burden of the analyzed package.

An NA value in the ImportedAndUsed column indicates that the function pkgDepMetrics() could not identify what functionality calls in the analyzed package are made to the dependency.

Author(s)

Robert Castelo

Charlotte Soneson

Examples

depdf <- buildPkgDependencyDataFrame(
  dependencies=c("Depends", "Imports"), 
  repo=c("BioCsoft", "CRAN")
)
pkgDepMetrics('BiocPkgTools', depdf)


seandavi/BiocPkgTools documentation built on Feb. 2, 2024, 12:02 p.m.