Skip to content

Commit b2bbcf6

Browse files
committed
fix user relation matrix construct #59 when only 1 row
1 parent 3a49c97 commit b2bbcf6

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-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.038
3+
Version: 0.1.3.039
44
Authors@R:
55
person("Mark", "Padgham", , "mark.padgham@email.com", role = c("aut", "cre"),
66
comment = c(ORCID = "0000-0003-2172-5265"))

R/quarto-dashboard.R

+4
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ get_user_network <- function (data_users) {
4747
rels <- user_relation_matrices (data_users)
4848
index <- which (!grepl ("^login", names (rels)))
4949
relmat <- apply (as.matrix (rels [, index]), 2, function (i) i / sum (i))
50+
if (!is.matrix (relmat)) {
51+
relmat <- matrix (relmat, nrow = 1L)
52+
}
53+
relmat [which (is.na (relmat))] <- 0
5054
relvec <- 20 * rowSums (relmat) / ncol (relmat)
5155
reldf <- cbind (rels [, 1:2], value = relvec)
5256
names (reldf) <- c ("source", "target", "value")

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.038",
11+
"version": "0.1.3.039",
1212
"programmingLanguage": {
1313
"@type": "ComputerLanguage",
1414
"name": "R",

0 commit comments

Comments
 (0)