From 0b72e138c2d6dfd570d12c3d1fa9746105014eda Mon Sep 17 00:00:00 2001 From: nikosbosse Date: Fri, 15 May 2020 19:45:02 +0200 Subject: [PATCH] Updated check_suggest to allow for custom dev messages for packages not on CRAN --- R/utils.R | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/R/utils.R b/R/utils.R index 86c54a2..b362855 100644 --- a/R/utils.R +++ b/R/utils.R @@ -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) } } + + + + +