Skip to content

Commit 31f8e8f

Browse files
committed
add dashboard network page for #59
1 parent b2bbcf6 commit 31f8e8f

File tree

3 files changed

+55
-2
lines changed

3 files changed

+55
-2
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: repometrics
22
Title: Metrics for Your Code Repository
3-
Version: 0.1.3.039
3+
Version: 0.1.3.040
44
Authors@R:
55
person("Mark", "Padgham", , "mark.padgham@email.com", role = c("aut", "cre"),
66
comment = c(ORCID = "0000-0003-2172-5265"))

codemeta.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"codeRepository": "https://github.com/ropensci-review-tools/repometrics",
99
"issueTracker": "https://github.com/ropensci-review-tools/repometrics/issues",
1010
"license": "https://spdx.org/licenses/GPL-3.0",
11-
"version": "0.1.3.039",
11+
"version": "0.1.3.040",
1212
"programmingLanguage": {
1313
"@type": "ComputerLanguage",
1414
"name": "R",

inst/extdata/quarto/network.qmd

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
title: "Network"
3+
execute:
4+
echo: false
5+
format:
6+
html:
7+
fig-width: 8
8+
fig-height: 4
9+
code-fold: false
10+
---
11+
12+
```{r load-pkg, echo = FALSE, message = FALSE}
13+
library (repometrics)
14+
requireNamespace ("dplyr", quietly = TRUE)
15+
requireNamespace ("tidyr", quietly = TRUE)
16+
```
17+
```{r load-data}
18+
dat_pkg <- readRDS ("results-repo.Rds")
19+
dat_users <- readRDS ("results-users.Rds")
20+
21+
deps <- dat_pkg$rm$dependencies
22+
get_dep_df <- function (deps, type = "Imports", group = 1L) {
23+
index <- which (deps$type == type)
24+
data.frame (id = deps$name [index], group = rep (group, length (index)))
25+
}
26+
27+
nodes_pkg_ <- rbind (
28+
get_dep_df (deps, "Imports", 1L),
29+
get_dep_df (deps, "Suggests", 2L)
30+
)
31+
nodes_user <- data.frame (id = dat_pkg$rm$contribs_from_gh_api$login, group = 4L)
32+
nodes_user$group [which (nodes_user$id %in% names (dat_users))] <- 3L
33+
```
34+
35+
```{ojs ForceGraph-import}
36+
import {ForceGraph} from "@d3/force-directed-graph-component"
37+
```
38+
39+
```{ojs import-network-data}
40+
network = FileAttachment("results-user-network.json").json()
41+
```
42+
43+
```{ojs ForceGraph-plot}
44+
chart = ForceGraph(network, {
45+
nodeId: d => d.id,
46+
nodeGroup: d => d.group,
47+
nodeTitle: d => `${d.id}\n${d.group}`,
48+
linkStrokeWidth: l => Math.sqrt(l.value),
49+
width,
50+
height: 600,
51+
invalidation // a promise to stop the simulation when the cell is re-run
52+
})
53+
```

0 commit comments

Comments
 (0)