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

rdev 1.11.0 #207

Merged
merged 5 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: rdev
Title: R Development Tools
Version: 1.10.11
Version: 1.11.0
Authors@R:
person("John", "Benninghoff", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-6230-4742"))
Expand All @@ -13,6 +13,7 @@ BugReports: https://github.com/jabenninghoff/rdev/issues
Imports:
checkmate,
cli,
cranlogs,
curl,
desc,
devtools,
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export(merge_release)
export(missing_deps)
export(new_branch)
export(open_files)
export(package_downloads)
export(rmd_metadata)
export(setup_analysis)
export(setup_rdev)
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# rdev 1.11.0

* Added function `package_downloads()`: A wrapper for `cranlogs::cran_downloads()` that summarizes the number of package downloads from the RStudio CRAN mirror

# rdev 1.10.11

* Minor updates
Expand Down
26 changes: 26 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,29 @@
writeLines(paste0("Opening files: ", toString(files)))
invisible(vapply(files, rstudioapi::navigateToFile, character(1)))
}

#' Summarize package downloads
#'
#' A wrapper for [cranlogs::cran_downloads()] that summarizes the number of package downloads from
#' the RStudio CRAN mirror.
#'
#' By default, the summary is for the last month.
#'
#' @param packages A character vector of the packages to query.
#' @param when The period to summarize, one of `last-day`, `last-week` or `last-month`
#' (the default).
#'
#' @return A data frame containing the total number of downloads by package for the specified
#' period, sorted by popularity.
#' @export
package_downloads <- function(packages, when = "last-month") {
checkmate::assert_character(packages, min.chars = 1)
if ("R" %in% packages) {
stop("Querying downloads of R is not supported!")
}

df <- cranlogs::cran_downloads(packages = packages, when = when) |>
stats::aggregate(by = count ~ package, FUN = sum)

Check warning on line 241 in R/utils.R

View check run for this annotation

Codecov / codecov/patch

R/utils.R#L240-L241

Added lines #L240 - L241 were not covered by tests

df[order(df$count, decreasing = TRUE), ]

Check warning on line 243 in R/utils.R

View check run for this annotation

Codecov / codecov/patch

R/utils.R#L243

Added line #L243 was not covered by tests
}
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,10 @@ ci()
#> * creating vignettes ... OK
#> * checking for LF line-endings in source and make files and shell scripts
#> * checking for empty or unneeded directories
#> * building ‘rdev_1.10.11.tar.gz’
#> * building ‘rdev_1.11.0.tar.gz’
#>
#> ── R CMD check ─────────────────────────────────────────────────────────────────
#> * using log directory ‘/private/var/folders/vn/cw5f9gws42v9m8mdsds_zbl00000gp/T/RtmpbGt8X8/filef8553618c29d/rdev.Rcheck’
#> * using log directory ‘/private/var/folders/vn/cw5f9gws42v9m8mdsds_zbl00000gp/T/Rtmpl0ug8f/filefaae5bd77b88/rdev.Rcheck’
#> * using R version 4.4.0 (2024-04-24)
#> * using platform: aarch64-apple-darwin20
#> * R was compiled by
Expand All @@ -242,7 +242,7 @@ ci()
#> * using session charset: UTF-8
#> * using option ‘--no-manual’
#> * checking for file ‘rdev/DESCRIPTION’ ... OK
#> * this is package ‘rdev’ version ‘1.10.11
#> * this is package ‘rdev’ version ‘1.11.0
#> * package encoding: UTF-8
#> * checking package namespace information ... OK
#> * checking package dependencies ... OK
Expand Down Expand Up @@ -297,8 +297,8 @@ ci()
#> * DONE
#>
#> Status: OK
#> ── R CMD check results ─────────────────────────────────────── rdev 1.10.11 ────
#> Duration: 33.1s
#> ── R CMD check results ─────────────────────────────────────── rdev 1.11.0 ────
#> Duration: 31.7s
#>
#> 0 errors ✔ | 0 warnings ✔ | 0 notes ✔
```
1 change: 1 addition & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ reference:
- extra_deps
- urlchecker-reexports
- html_url_check
- package_downloads
- title: rdev Package
desc: >
rdev package documentation
Expand Down
2 changes: 1 addition & 1 deletion docs/404.html

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

2 changes: 1 addition & 1 deletion docs/LICENSE-text.html

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

2 changes: 1 addition & 1 deletion docs/LICENSE.html

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

2 changes: 1 addition & 1 deletion docs/TODO.html

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

2 changes: 1 addition & 1 deletion docs/articles/analysis-package-layout.html

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

2 changes: 1 addition & 1 deletion docs/articles/index.html

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

2 changes: 1 addition & 1 deletion docs/articles/rdev.html

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

2 changes: 1 addition & 1 deletion docs/articles/style-guide.html

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

6 changes: 3 additions & 3 deletions docs/authors.html

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

12 changes: 6 additions & 6 deletions docs/index.html

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

6 changes: 5 additions & 1 deletion docs/news/index.html

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

2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ articles:
analysis-package-layout: analysis-package-layout.html
rdev: rdev.html
style-guide: style-guide.html
last_built: 2024-05-23T19:56Z
last_built: 2024-06-05T21:54Z
urls:
reference: https://jabenninghoff.github.io/rdev/reference
article: https://jabenninghoff.github.io/rdev/articles
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/build_analysis_site.html

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

2 changes: 1 addition & 1 deletion docs/reference/build_quarto_site.html

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

2 changes: 1 addition & 1 deletion docs/reference/build_rdev_site.html

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

2 changes: 1 addition & 1 deletion docs/reference/check_renv.html

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

2 changes: 1 addition & 1 deletion docs/reference/ci.html

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

2 changes: 1 addition & 1 deletion docs/reference/create_github_repo.html

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

2 changes: 1 addition & 1 deletion docs/reference/deps_check.html

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

2 changes: 1 addition & 1 deletion docs/reference/get_license.html

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

2 changes: 1 addition & 1 deletion docs/reference/get_release.html

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

2 changes: 1 addition & 1 deletion docs/reference/html_url_check.html

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

Loading
Loading