Skip to content

Commit

Permalink
Updates for CRAN comments
Browse files Browse the repository at this point in the history
  • Loading branch information
elimillera committed Jan 28, 2022
1 parent 9a69408 commit ba174a2
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 83 deletions.
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ importFrom(utils,available.packages)
importFrom(utils,capture.output)
importFrom(utils,getS3method)
importFrom(utils,head)
importFrom(utils,installed.packages)
importFrom(utils,packageDescription)
importFrom(utils,packageName)
importFrom(utils,packageVersion)
Expand Down
5 changes: 2 additions & 3 deletions R/pkg_ref_class.R
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ as_pkg_ref.pkg_ref <- function(x, ...) {
}


#' @importFrom utils installed.packages available.packages packageVersion
#' @importFrom utils available.packages packageVersion
#' @export
as_pkg_ref.character <- function(x, repos = getOption("repos", "https://cran.rstudio.com"),
source = NULL, lib.loc = NULL, ...) {
Expand Down Expand Up @@ -302,9 +302,8 @@ determine_pkg_source <- function(x, source, repos) {

# non-source package
} else if (grepl("^[[:alpha:]][[:alnum:].]*[[:alnum:]]$", x)) {
ip <- memoise_installed_packages()

if (x %in% ip[, "Package"]) {
if (length(find.package(x, quiet = TRUE)) != 0) {
return("pkg_install")

# if its not installed, pull the package to check it
Expand Down
34 changes: 0 additions & 34 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,27 +100,6 @@ firstS3method <- function(f, classes, envir = parent.frame()) {
#' Defaults to \code{FALSE}, capturing the passed expression.
#' @inheritParams base::sink
#'
#' @examples
#' fn <- function() {
#' print(paste(letters[1:3], collapse = ", "))
#' warning("easy as")
#' message(paste(1:3, collapse = ", "))
#' message("simple as")
#' warning("do re mi")
#' return(3L)
#' }
#'
#' capture_expr_output <- utils::getFromNamespace("capture_expr_output", "riskmetric")
#' console_output <- capture_expr_output(fn())
#'
#' # console_output
#' # > fn()
#' # [1] "a, b, c"
#' # Warning in fn(): easy as
#' # 1, 2, 3
#' # simple as
#' # Warning in fn(): do re mi
#' # [1] 3
#'
#' @importFrom utils head tail
#' @return an with_eval_recording object
Expand Down Expand Up @@ -303,19 +282,6 @@ print.with_eval_recording <- function(x, playback = FALSE, cr = TRUE, ...,
#' condition.
#' @param .opts A named list of arguments to pass to \code{grepl}
#' @param .envir The environment in which \code{expr} is to be evaluated
#' @examples
#' riskmetric:::suppressMatchingConditions({
#' print(paste(letters[1:3], collapse = ", "))
#' warning(structure(
#' list(message = "easy as", call = NULL),
#' class = c("custom_warning", "warning", "condition")))
#' message(paste(1:3, collapse = ", "))
#' message("simple as")
#' warning("do re mi")
#' },
#' message = "\\d",
#' custom_warning = "as$",
#' warning = "\\w{2}\\s")
#' @return a message printed on console
#' @keywords internal
suppressMatchingConditions <- function(expr, ..., .opts = list(),
Expand Down
7 changes: 0 additions & 7 deletions R/utils_memoised.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,6 @@ memoise_bioc_mirrors <- memoise::memoise({



#' @importFrom memoise memoise
memoise_installed_packages <- memoise::memoise({
function(...) utils::installed.packages(...)
})



#' @importFrom memoise memoise
memoise_available_packages <- memoise::memoise({
Sys.sleep(20)
Expand Down
1 change: 0 additions & 1 deletion R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@
# if non-interactive, cache package sources on load
if (!interactive()) {
memoise_available_packages()
memoise_installed_packages()
}
}
4 changes: 4 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Submission 2

Per comments from Gregor Seyer, the use of installed.packages was replaced with find.package. Examples for unexported functions were also removed.

## Test environments
* local R installation, R 3.6.2
* local R installation, R 3.6.2
Expand Down
23 changes: 0 additions & 23 deletions man/capture_expr_output.Rd

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

14 changes: 0 additions & 14 deletions man/suppressMatchingConditions.Rd

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

0 comments on commit ba174a2

Please sign in to comment.