diff --git a/DESCRIPTION b/DESCRIPTION index ed67bf7..32bc72d 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: repometrics Title: Metrics for Your Code Repository -Version: 0.1.2.030 +Version: 0.1.2.034 Authors@R: person("Mark", "Padgham", , "mark.padgham@email.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0003-2172-5265")) diff --git a/codemeta.json b/codemeta.json index 74f1aab..fe3a7ca 100644 --- a/codemeta.json +++ b/codemeta.json @@ -8,7 +8,7 @@ "codeRepository": "https://github.com/ropensci-review-tools/repometrics", "issueTracker": "https://github.com/ropensci-review-tools/repometrics/issues", "license": "https://spdx.org/licenses/GPL-3.0", - "version": "0.1.2.030", + "version": "0.1.2.034", "programmingLanguage": { "@type": "ComputerLanguage", "name": "R", diff --git a/inst/extdata/quarto/contributors.qmd b/inst/extdata/quarto/contributors.qmd index d64d501..a85e2d8 100644 --- a/inst/extdata/quarto/contributors.qmd +++ b/inst/extdata/quarto/contributors.qmd @@ -71,17 +71,21 @@ log_reg <- dplyr::group_by (log, gh_handle) |> )) |> dplyr::group_by (gh_handle) |> dplyr::mutate ( - nfiles_changed = cumsum (nfiles_changed), - lines_added = cumsum (lines_added), - lines_removed = cumsum (lines_removed), - ncommits = cumsum (ncommits), + nfiles_changed_cum = cumsum (nfiles_changed), + lines_added_cum = cumsum (lines_added), + lines_removed_cum = cumsum (lines_removed), + ncommits_cum = cumsum (ncommits), date = as.Date (date) ) |> dplyr::ungroup () log_reg <- tidyr::pivot_longer ( log_reg, - c ("nfiles_changed", "lines_added", "lines_removed", "ncommits") + c ( + "nfiles_changed", "lines_added", "lines_removed", "ncommits", + "nfiles_changed_cum", "lines_added_cum", "lines_removed_cum", + "ncommits_cum" + ) ) ``` @@ -112,11 +116,50 @@ viewof varNameGitLog = Inputs.radio( value: "ncommits" } ) +``` + +```{ojs cumulative-checkbox-gitlog} +viewof cumulativeGitLog = Inputs.radio(["true", "false"], + { + value: "true", + label: "Cumulative Values:" + } +) +``` + +```{ojs log-scale-checkbox-gitlog} +viewof logScaleGitLog = Inputs.radio(["true", "false"], + { + value: "true", + label: "Log Scale:" + } +) +logTypeGitLog = logScaleGitLog === "true" ? "log" : "linear"; +``` + +```{ojs transform-gitlog-data} +varNameGitLogActual = cumulativeGitLog === "true" ? varNameGitLog + "_cum" : varNameGitLog; logFiltered = log.filter(function(row) { - return varNameGitLog.includes(row.name) + return row.name === varNameGitLogActual; }) + +function replaceZeroWithOneLog(data) { + return data.map(row => { + const newRow = { ...row }; + if (logTypeGitLog === "log") { + Object.values(newRow).forEach(value => { + if (typeof value === "number" && value === 0) { + newRow.value = 1; + } + }); + } + return newRow; + }); +} +logFiltered01 = replaceZeroWithOneLog(logFiltered); ``` + ```{ojs count-contributors} function getMaxValues(log, varNameGitLog) { const ctbs = log.map((item) => item.gh_handle); @@ -159,20 +202,10 @@ function reduceLogToCtbs(log, maxValues, numContribsGitLog) { return logReduced; } logReduced = reduceLogToCtbs(logFiltered, maxValues, numContribsGitLog); -``` - -```{ojs log-scale-checkbox-gitlog} -viewof logScaleGitLog = Inputs.radio(["true", "false"], - { - value: "true", - label: "Log Scale:" - } -) -logTypeGitLog = logScaleGitLog === "true" ? "log" : "linear"; +logReduced01 = reduceLogToCtbs(logFiltered01, maxValues, numContribsGitLog); ``` - ```{ojs log-plot} Plot.plot({ style: ` @@ -185,7 +218,7 @@ Plot.plot({ marks: [ Plot.ruleY([0]), Plot.lineY( - logReduced, + logReduced01, { x: "date", y: "value", @@ -195,7 +228,7 @@ Plot.plot({ }, ), Plot.text( - logReduced, + logReduced01, Plot.selectLast({ x: "date", y: "value", @@ -310,7 +343,7 @@ viewof varNameIssues = Inputs.radio( ) ``` -```{ojs log-scale-checkbox-issues} +```{ojs cumulative-checkbox-issues} viewof cumulativeIssues = Inputs.radio(["true", "false"], { value: "true", @@ -320,7 +353,7 @@ viewof cumulativeIssues = Inputs.radio(["true", "false"], ``` -```{ojs cumulative-checkbox-issues} +```{ojs log-scale-checkbox-issues} viewof logScaleIssues = Inputs.radio(["true", "false"], { value: "false", @@ -329,7 +362,7 @@ viewof logScaleIssues = Inputs.radio(["true", "false"], ) logTypeIssues = logScaleIssues === "true" ? "log" : "linear"; -function replaceZeroWithOne(data) { +function replaceZeroWithOneIssues(data) { return data.map(row => { const newRow = { ...row }; if (logTypeIssues === "log") { @@ -349,7 +382,7 @@ varNameIssuesActual = cumulativeIssues === "true" ? varNameIssues + "_cum" : var issueDataFiltered = issueData.filter(function(row) { return row.name === varNameIssuesActual; }) -issueDataFiltered01 = replaceZeroWithOne(issueDataFiltered); +issueDataFiltered01 = replaceZeroWithOneIssues(issueDataFiltered); ``` @@ -358,7 +391,7 @@ Plot.plot({ style: ` overflow: visible; `, - marginLeft: 90, + marginLeft: 80, marginBottom: 50, x: { grid: true }, y: { grid: true, type: logTypeIssues }, @@ -396,6 +429,15 @@ Plot.plot({ labelArrow: false } ), + Plot.axisY( + { + fontSize: 24, + label: "Value", + labelAnchor: "center", + labelOffset: 75, + ticks: [] + } + ), ] }) ``` diff --git a/inst/extdata/quarto/fn-stats.qmd b/inst/extdata/quarto/fn-stats.qmd index 3b5f377..6ace798 100644 --- a/inst/extdata/quarto/fn-stats.qmd +++ b/inst/extdata/quarto/fn-stats.qmd @@ -1,5 +1,5 @@ --- -title: "Git history" +title: "Package stats" execute: echo: false format: