-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,8 @@ Imports: | |
covr, | ||
rvest, | ||
memoise, | ||
janitor | ||
janitor, | ||
cranlogs | ||
RoxygenNote: 7.0.2 | ||
Suggests: | ||
knitr, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#' Assess a package for the number of downloads in the past year | ||
#' | ||
#' @details The more times a package has been downloaded the more extensive the user testing and the greater chance there is of someone finding a bug and logging it. | ||
#' | ||
#' @eval assess_family_roxygen( | ||
#' "downloads_1yr", | ||
#' "a numeric value between [0,1] indicating the volume of downloads") | ||
#' | ||
#' @export | ||
assess_downloads_1yr <- function(x, ...){ | ||
UseMethod("assess_downloads_1yr") | ||
} | ||
# assign a friendly name for assess column | ||
attr(assess_downloads_1yr,"column_name") <- "downloads_1yr" | ||
attr(assess_downloads_1yr,"label") <- "number of downloads in the past year" | ||
|
||
pkg_ref_cache.downloads <- function(x, ...) { | ||
cran_downloads(x$name, from=Sys.Date()-365, to=Sys.Date()) | ||
} | ||
|
||
#' @import cranlogs | ||
#' @export | ||
assess_downloads_1yr.pkg_ref <- function(x, ...) { | ||
downloads_1yr <- sum(x$downloads$count) | ||
pkg_metric(downloads_1yr, class = "pkg_metric_downloads_1yr") | ||
} | ||
|
||
# Defining an Assessment Scoring Function | ||
#' Score a package for the number of downloads in the past year | ||
#' | ||
#' Convert the number of downloads \code{x} in the past year into a validation score [0,1] | ||
#' \deqn{ 1 - 150,000 / (x + 150,000) } | ||
#' | ||
#' @details The scoring function is a simplification of the classic logistic curve | ||
#' \deqn{ 1 / (1 + exp(-k(x-x[0])) } | ||
#' with a log scale for the number of downloads \eqn{x = log(x)}, | ||
#' sigmoid midpoint is 1000 downloads, ie. \eqn{x[0] = log(1,000)}, | ||
#' and logistic growth rate of \eqn{k = 0.5}. | ||
# #' \deqn{ 1 - 1 / (1 + exp(log(x)-log(1.5e5))) = 1 - 150,000 / (x + 150,000) } | ||
#' | ||
#' @eval score_family_roxygen("downloads_1yr") | ||
#' @return numeric value between \code{0} (low) and \code{1} (high download volume) converting the number of downloads. | ||
#' | ||
#' @export | ||
score.pkg_metric_downloads_1yr <- function(x, ...) { | ||
# simplification from logistic: 1 - 1 / (1 + exp(log(x)-log(1.5e5))) | ||
1 - 1.5e5 / (x + 1.5e5) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,17 +19,25 @@ exploring the heterogeneity of code quality, and begin a broader conversation | |
about the validation of R packages. Primarily, this effort aims to provide some | ||
context for validation within regulated industries. | ||
|
||
## Quick Start | ||
We sperate three steps in the workflow to assess the risk of an R package using `riskmetric`: | ||
|
||
### Installation | ||
1. **Finding a source for package information (installed package or CRAN/git source)** `pkg_ref()` | ||
1. **Assessing the package under validation criteria** `assess()` | ||
1. **Scoring assessment criteria** `score()` | ||
1. **Summarize scores into an aggregate risk metric** `summarize_risk()` | ||
|
||
The results will be a datasets of validation criteria and its overall risk score for each package as | ||
showin in the example below. | ||
|
||
## Installation | ||
|
||
`riskmetric` is not yet on CRAN. Until it is, install using `devtools`. | ||
|
||
```r | ||
devtools::install_github("pharmaR/riskmetric") | ||
``` | ||
|
||
### Example | ||
## Example | ||
|
||
Scrape metadata locally or remotely, then assess that metadata and score it to | ||
estimate risk. For each package, derive a composite measure of risk, or a | ||
|
@@ -49,10 +57,11 @@ pkg_ref(c("riskmetric", "utils", "tools")) %>% | |
|
||
## Get Involved | ||
|
||
We had a bi-weekly sprint meeting for developer to discuss the progress. | ||
We had a bi-weekly sprint meeting for developer to discuss the progress. | ||
|
||
* Frequecy: every two weeks | ||
* Starting Time: 2019/11/06 12:00 PM - 12:30 PM | ||
* Contact `[email protected]` to add into the meeting invitation. | ||
* Date: 1st and 3rd Wednesday of the month. | ||
* Meeting Time: 12:00PM - 12:30PM EST | ||
* [Project Planning Meeting Structure](https://github.com/pharmaR/riskmetric/issues/57) | ||
* [Milestone](https://github.com/pharmaR/riskmetric/milestones) | ||
* [Meeting Room](https://merck.webex.com/join/zhanyilo) | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.