Skip to content

crsh/depgraph

Repository files navigation

depgraph: Plot the complete dependency graph of an R package

CRAN/METACRAN Project Status: Active – The project has reached a stable, usable state and is being actively developed. GitHub last commit (devel) GitHub bug issues

Provides a function to plot the complete dependency graph of an R package and helps to cut down on dependencies.

Installation

You can install the development version from GitHub with:

# install.packages("remotes")
remotes::install_github("crsh/depgraph")

Example

Currently, depgraph ships only a single function that plots the dependency graph of an R package based on its DESCRIPTION file. Consider the following example.

library("depgraph")

plot_dependency_graph(
  pkg = multibridge_pkg
  , suggests = FALSE
  , option = "cividis"
)
Dependency graph of a historic development version of the R package `multibridge`.

Dependency graph of a historic development version of the R package multibridge.

Such plots can be used for at least two purposes:

  1. Including dependency graphs in an R package README shows users how many packages their work depends on (indirectly). This is useful as a very rough index of package reliability (less dependencies generally mean less potential for breaking upstream changes) and installation time.
  2. Dependency graphs are useful to identify potential to cut down on dependencies. Briefly, in these graphs you can look for “hot spots” in the network (big bright dots), which represent packages that have many upstream dependencies but are potentially easy to remove because they have few downstream dependencies (that is, only your package depends on them).

Some more details on how to use this graph to reduce package dependencies are given in the package vignette:

vignette("depgraph", package = "depgraph")

Package dependencies

Yeah, I know…:see_no_evil:

plot_dependency_graph(
  pkg = "."
  , suggests = FALSE
  , option = "cividis"
)
Dependency graph of `depgraph`.

Dependency graph of depgraph.

About

Provides an R function to plot the complete dependency graph of an R package and helps to cut down on dependencies.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages