Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg_assess() returns different object types when assessing 1 package vs. >1 package #342

Open
fh-kpikhart opened this issue May 1, 2024 · 1 comment
Labels
Enhancement New feature or request

Comments

@fh-kpikhart
Copy link
Contributor

It would be helpful if pkg_assess() always returned a tibble in order to be able to programmatically manipulate the outputs, but when only 1 pkg_ref is passed in, it returns a list.

library(dplyr)
library(riskmetric)
packageVersion("riskmetric")

[1] ‘0.2.4’

# Assessing >1 packages gives a tibble
c("dplyr", "ggplot2") %>%
  pkg_ref(source = "pkg_cran_remote", repos = c("https://cran.rstudio.com")) %>%
  pkg_assess(all_assessments[1:2])

# A tibble: 2 × 5
  package version pkg_ref              bugs_status covr_coverage
  <chr>   <chr>   <lst_f_p_>           <lst_f_p_>  <lst_f_p_>   
1 dplyr   1.1.4   dplyr<cran_remote>   <error>     NA           
2 ggplot2 3.5.1   ggplot2<cran_remote> <error>     NA 

# Assessing 1 package gives a list
c("dplyr") %>%
  pkg_ref(source = "pkg_cran_remote", repos = c("https://cran.rstudio.com")) %>%
  pkg_assess(all_assessments[1:2])

<list_of_pkg_metric[2]>
$bugs_status
 [1] FALSE FALSE FALSE  TRUE FALSE FALSE  TRUE FALSE FALSE FALSE  TRUE FALSE  TRUE FALSE  TRUE FALSE FALSE  TRUE
[19] FALSE  TRUE  TRUE  TRUE  TRUE  TRUE FALSE FALSE FALSE FALSE  TRUE  TRUE

$covr_coverage
[1] NA
attr(,"class")
[1] "pkg_metric_na"            "pkg_metric_condition"     "pkg_metric_covr_coverage" "pkg_metric"              
[5] "logical"                 
attr(,"label")
[1] "Package unit test coverage"
@emilliman5
Copy link
Collaborator

We have discussed this and it has been brought up in directly #231. My preference would be to always return a list of lists and provide an as_tibble method to easily coerce. a list of list, IMHO, is a more natural representation of assessments than a df (vectors and dfs, nested in side columns of a df is not m favorite). By extension we should also return the same object type for scores, in this case a df makes sense, as it is one value per colomn.

@emilliman5 emilliman5 added the Enhancement New feature or request label May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants