stopifnotMessage = function(...) {
ok = TRUE
errors = list()
listargs = list(...)
for (i in seq_along(listargs)) {
if (listargs[i] == FALSE) {
errors[[""]] = names(listargs)[i]
ok = FALSE
}
}
if (ok == FALSE) {
stop(paste0("\n\nWhen validating the arguments:\n ", paste(errors, collapse="\n ")))
}
}
checkLogical = function(x) {
return (is.null(x) || (length(x) == 1 && is.logical(x)))
}
checkInteger = function(x) {
x_int = as.integer(x)
return (is.null(x) || (length(x_int) == 1 && is.integer(x_int) && !is.na(x_int)))
}
checkParentDir = function(x, optional=FALSE) {
if (optional && is.null(x)) {
return (TRUE)
}
dirName = fs::path_dir(x)
return (fs::dir_exists(dirName)[[1]])
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.