Nothing
#' @import utils
#' @import ggplot2
check_suggests <- function(pkg) {
pkg_flag <- tryCatch(packageVersion(pkg), error = function(e) NA)
if (is.na(pkg_flag)) {
msg <- message(paste0('\n', pkg, ' must be installed for this functionality.'))
if (interactive()) {
message(msg, "\nWould you like to install it?")
if (menu(c("Yes", "No")) == 1) {
install.packages(pkg)
} else {
stop(msg, call. = FALSE)
}
} else {
stop(msg, call. = FALSE)
}
}
}
check_numeric <- function(val, var = "n") {
if (!is.numeric(val)) {
stop(paste(var, "must be numeric."), call. = FALSE)
}
}
check_logical <- function(val, var = "normal") {
if (!is.logical(val)) {
stop(paste(var, "must be a logical value."), call. = FALSE)
}
}
check_positive <- function(val, var = "sd") {
if (val < 0) {
stop(paste(var, "must be a positive value."), call. = FALSE)
}
}
check_range <- function(val, min = 0, max = 1, var = "p") {
if ((val < min) | (val > max)) {
stop(paste(var, "must be between", min, "and", max, "only."), call. = FALSE)
}
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.