cran checks API: an update

Authors: Scott Chamberlain

If you have an R package on CRAN, you probably know about CRAN checks. Each package on CRAN, that is not archived on CRAN, has a checks page, like this one for ropenaq:
https://cloud.r-project.org/web/checks/check_results_ropenaq.html

cranchecks

The table above is results of running R CMD CHECK on the package on a combination of different operating systems, R versions and compilers. CRAN maintainers presumably use these as a basis for getting in touch with maintainers when these checks are failing.


Read the rest at rOpenSci | cran checks API: an update

1 Like

I am finding this a very useful tool however I am having an issue with the /history/:date route.
The example you use above works as expected however there appears to be a large number of dates that are returning an error, for example:
x ← jsonlite::stream_in(curl::curl(“https://cranchecks.info/history/2019-09-11”))

Returns:

opening curl input connection.
Error in FUN(X[[i]], …) : invalid multibyte string, element 1
closing curl input connection.

Any advice would be appreciated!

1 Like

Thanks for your question! I can replicate the problem you show. I am not sure what exactly is going wrong there, but the below seems to work, first downloading the file, then streaming the file in. Seems best to first download, then read in, probably want to replace file paths with non-temporary file paths if you want to keep files after the R session ends.

Let me know if this helps.

checks_download <- function(x) {
  url_base <- "https://cranchecks.info/history"
  path <- file.path(tempdir(), paste0(x, ".json.gz"))
  curl::curl_download(file.path(url_base, x),
    destfile = path)
  return(path)
} 

checks_read <- function(x) {
  tibble::as_tibble(jsonlite::stream_in(file(x)))
}

dates <- seq(as.Date("2019-10-01"), as.Date("2019-10-31"), by = "day")
paths <- lapply(dates, checks_download)
df <- dplyr::bind_rows(lapply(paths, checks_read))
1 Like

Thank you for the quick response, that worked brilliantly!

2 Likes