Provides a function to plot the complete dependency graph of an R package and helps to cut down on dependencies.
You can install the development version from GitHub with:
# install.packages("remotes")
remotes::install_github("crsh/depgraph")
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"
)
Such plots can be used for at least two purposes:
- 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. - 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")
Yeah, I know…:see_no_evil:
plot_dependency_graph(
pkg = "."
, suggests = FALSE
, option = "cividis"
)