check_required | R Documentation |
Throws an error if x
is missing.
check_required(x, arg = caller_arg(x), call = caller_env())
x |
A function argument. Must be a symbol. |
arg |
An argument name as a string. This argument will be mentioned in error messages as the input that is at the origin of a problem. |
call |
The execution environment of a currently
running function, e.g. |
arg_match()
f <- function(x) {
check_required(x)
}
# Fails because `x` is not supplied
try(f())
# Succeeds
f(NULL)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.