Skip to content

Commit

Permalink
Fixes for CRAN (#11)
Browse files Browse the repository at this point in the history
* Added a `value` section to `pkrt_set()`

* Specified the class of `pkrt_list()`'s output

* Removed `utils::installed.packages()` usage
  • Loading branch information
arnaudgallou authored Aug 27, 2024
1 parent 48b9610 commit 21d6aac
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
14 changes: 10 additions & 4 deletions R/pkrt-list.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#' This function automatically discards duplicate and base packages. You can use
#' `pkrt_list()` in combination with `renv::dependencies()` to cite all the
#' packages used in a project or directory.
#' @return A list of package citations.
#' @returns A list of package citations with S3 class `pkrt_list`.
#' @examples
#' # Create a list of citations
#' citations <- pkrt_list("pakret", "readr", "withr")
Expand All @@ -29,11 +29,17 @@ pkrt_list <- function(...) {
}

drop_base <- function(x) {
x[!x %in% get_base_pkgs()]
x[!x %in% base_pkgs()]
}

get_base_pkgs <- function() {
rownames(utils::installed.packages(.Library, priority = "base"))
base_pkgs <- function() {
if (getRversion() >= "4.4.0") {
return(asNamespace("tools")$standard_package_names()[["base"]])
}
c(
"base", "compiler", "datasets", "graphics", "grDevices", "grid", "methods",
"parallel", "splines", "stats", "stats4", "tcltk", "tools", "utils"
)
}

itemize_citations <- function(pkgs) {
Expand Down
1 change: 1 addition & 0 deletions R/pkrt-set.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#' to alter pakret's behavior for a few specific citations only.
#'
#' Use `NULL` to reset a parameter to its default value.
#' @returns This function is called for its side-effect. It returns no value.
#' @examples
#' pkrt_set(pkg = ":pkg (v. :ver) :ref")
#' pkrt("pakret")
Expand Down
7 changes: 7 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
This is a resubmission.

* I added a `value` section to `pkrt_set()`.
* I specified the class of the output in `pkrt_list()`.
* I removed `utils::installed.packages()` usage and replaced it with a more effecient alternative.
* There's no particular references for the methods used in my package to add to the package description.

## R CMD check results

0 errors | 0 warnings | 1 note
Expand Down
2 changes: 1 addition & 1 deletion man/pkrt_list.Rd

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

3 changes: 3 additions & 0 deletions man/pkrt_set.Rd

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

0 comments on commit 21d6aac

Please sign in to comment.