Score a package assessment, collapsing results into a single numeric
Source:R/pkg_score.R
pkg_score.Rd
pkg_score() calculates the risk involved with using a package. Risk ranges from 0 (low-risk) to 1 (high-risk).
Arguments
- x
A
pkg_metric
object, whose subclass is used to choose the appropriate scoring method for the atomic metric metadata. Optionally, atibble
can be provided, in which cases allpkg_metric
values will be scored.- ...
Additional arguments passed to
summarize_scores
when an object of classtbl_df
is provided, unused otherwise.- error_handler
Specify a function to be called if the class can't be identified. Most commonly this occurs for
pkg_metric
objects of subclasspkg_metric_error
, which is produced when an error is encountered when calculating an associated assessment.
Value
A numeric value if a single pkg_metric
is provided, or a
tibble
with pkg_metric
objects scored and
returned as numeric values when a tibble
is provided.
Examples
if (FALSE) { # \dontrun{
# scoring a single assessment
metric_score(assess_has_news(pkg_ref("riskmetric")))
# scoring many assessments as a tibble
library(dplyr)
pkg_score(pkg_assess(as_tibble(pkg_ref(c("riskmetric", "riskmetric")))))
} # }