-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME.Rmd
81 lines (59 loc) · 3.01 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
set.seed(65787908)
```
# depgraph: Plot the complete dependency graph of an R package
<!-- badges: start -->
[![CRAN/METACRAN](https://img.shields.io/cran/v/depgraph?label=CRAN&logo=r)](https://cran.r-project.org/web/packages/depgraph/index.html) [![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) ![GitHub last commit (devel)](https://img.shields.io/github/last-commit/crsh/depgraph/main?label=Last commit&logo=github&logoColor=%23FFF) [![GitHub bug issues](https://img.shields.io/github/issues/crsh/depgraph/bug?label=Bugs&logo=github&logoColor=%23FFF)](https://github.com/crsh/depgraph/issues?q=is%3Aopen+is%3Aissue+label%3Abug)
<!-- badges: end -->
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 released version of `depgraph` from [CRAN](https://CRAN.R-project.org) with:
``` r
install.packages("depgraph")
```
-->
You can install the development version from [GitHub](https://github.com/) with:
~~~r
# 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.
```{r fig.align = "center", fig.cap = "Dependency graph of a historic development version of the R package `multibridge`.", fig.height = 5, fig.width = 7, warning = FALSE}
library("depgraph")
plot_dependency_graph(
pkg = multibridge_pkg
, suggests = FALSE
, option = "cividis"
)
```
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:
~~~r
vignette("depgraph", package = "depgraph")
~~~
## Package dependencies
Yeah, I know...:see_no_evil:
```{r fig.align = "center", fig.cap = "Dependency graph of `depgraph`.", fig.height = 5, fig.width = 7, warning = FALSE}
plot_dependency_graph(
pkg = "."
, suggests = FALSE
, option = "cividis"
)
```