Exporting metrics#386
Conversation
|
@dgkf @llrs-roche Following our discussion last Friday, I wrote a function An example output for a single package: An example output for multiple packages: I think having a dedicated separate function This is a starting draft version that basically only formats the current @dgkf @llrs-roche at this point does this qualify as a minimal example of what we're aiming for? should the values be score or more like assessments? for example should we have this: or this : |
|
This is looking great. I think we could use this as a target for the report to leverage as an input. for example should we have this:
I'm not sure what the best path is here. My first impulse is that the exact urls are already in the DESCRIPTION, so maybe we just want them collapsed into a number for easier programmatic use. |
|
Sorry it took me some time to check on this. This looks promising. When writing two metrics I found that it writes: Note that instead of 0 as it is not an integer due to the dplyr call we get all these decimals. Do you think this could be modified? Or this is I too agree that the number is better. If this is merged with the output of The function is not documented (and it takes a long time to document it given the complex documentation of the "double dispath" mechanism with roxygen2 7.3.2). But after documenting it worked well. I think it would also make sense to explore how to read that file back into a score object (I would say even if it loses some attributes, as this could actually be a sign of the data origin) |
|
@llrs-roche As you flagged this: we do not plan to touch |
|
Thanks @eddelbuettel for the info, we'll explore how we can approach this. Maybe just formatting each record and append them to a single file will work. |
|
Sounds good. Also happy to chat more (over on that issue). Other than ensuring utf-8 (which is now more or less a given on all R platforms) we feel we have no TODO for |
|
Was playing a bit more with the numeric precision problem: If we export just one package via: We can work around this issue if instead of just While exploring the inner works I realized |
|
@llrs-roche the numeric precision problem was caused by As for |
|
I still see some inconsistencies between the different fields: But with the round trip even if the appearance after We only miss a function to convert back to scores: adding the attributes and class. But we can wait until there are updates on the future of riskmetric package |
|
First, thanks @llrs-roche for turning me on to this new-ish workflow. As a test, I used previous scored results for all of CRAN from the # Install dev {riskscore} package from GitHub
# Note: takes a min to install because there are 'heavy' .rda files stored here
# which is another reason switching to .dcf files is preferred!
remotes::install_github("pharmaR/riskscore", force = TRUE, ref = "dcf-test")
cran_scored <- riskmetric::pkg_metric_import(
system.file("extdata/cran_scored_20250812.dcf", package = "riskscore")
)
object.size(cran_scored) / 1000000 # 8 MBQuestion for allCould Running following code: assessed <-
c("dplyr") |>
riskmetric::pkg_ref(source = "pkg_cran_remote", repos = c("https://cran.rstudio.com")) |>
riskmetric::pkg_assess() |>
riskmetric::pkg_metric_export()... produces the output below. Notice how the results are trimmed to one element per metric? For example, The assessment values for DCF Output |
PR to address #376
Challenges:
identical(metrics, metrics |> write() |> read())) means restoring the labels and some attributes of the metrics: