Skip to content

Commit

Permalink
Updated check_suggest to allow for custom dev messages for packages n…
Browse files Browse the repository at this point in the history
…ot on CRAN
  • Loading branch information
nikosbosse committed May 15, 2020
1 parent d998d51 commit 0b72e13
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,21 @@ globalVariables(
"model")
)

check_suggests <- function(pkg_name){
check_suggests <- function(pkg_name, dev_message = NULL){
if (!requireNamespace(pkg_name, quietly = TRUE)) {
msg <- sprintf("This function requires `%s` to work. Please install it.\n", pkg_name)
stop(msg,
call. = FALSE)
msg <- sprintf("This function requires `%s` to work.",
pkg_name)

if (!is.null(dev_message)) {
msg <- paste(msg, dev_message)
} else{
msg <- paste(msg, "Please install it.\n")
}
stop(msg, call. = FALSE)
}
}





0 comments on commit 0b72e13

Please sign in to comment.