Skip to content

Commit

Permalink
Merge pull request #60 from ropensci-review-tools/cran-current
Browse files Browse the repository at this point in the history
cran-current-from-archive for #56
  • Loading branch information
mpadge authored Aug 5, 2024
2 parents 177d731 + 30858ca commit dc4849f
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: pkgstats
Title: Metrics of R Packages
Version: 0.1.5.027
Version: 0.1.5.028
Authors@R:
person("Mark", "Padgham", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-2172-5265"))
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export(dl_pkgstats_data)
export(extract_tarball)
export(loc_stats)
export(pkgstats)
export(pkgstats_cran_current_from_full)
export(pkgstats_fn_names)
export(pkgstats_fns_from_archive)
export(pkgstats_from_archive)
Expand Down
23 changes: 23 additions & 0 deletions R/cran-data-current.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#' Reduce `data.frame` of full CRAN archive data to current packages only.
#'
#' @inheritParams pkgstats_from_archive
#' @family archive
#' @export
pkgstats_cran_current_from_full <- function (prev_results, results_file = NULL) {

prev_tarball <- paste0 (prev_results$package, "_", prev_results$version)

cran_pkgs <- tools::CRAN_package_db ()
cran_tarball <- paste0 (cran_pkgs$Package, "_", cran_pkgs$Version)

index <- which (prev_tarball %in% cran_tarball)
res <- prev_results [index, ]

if (!is.null (res) && !is.null (results_file)) {

results_file <- archive_results_file_name (results_file)
saveRDS (res, results_file)
}

return (res)
}
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"codeRepository": "https://github.com/ropensci-review-tools/pkgstats",
"issueTracker": "https://github.com/ropensci-review-tools/pkgstats/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "0.1.5.027",
"version": "0.1.5.028",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down
1 change: 1 addition & 0 deletions man/dl_pkgstats_data.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions man/pkgstats_cran_current_from_full.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/pkgstats_fns_from_archive.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/pkgstats_from_archive.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/pkgstats_update.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit dc4849f

Please sign in to comment.