Description Usage Arguments Value Author(s) Examples
Checks if an argument is a numeric vector
1 | assert_numeric_vector(arg, optional = FALSE)
|
arg |
A function argument to be checked |
optional |
Is the checked parameter optional? If set to |
The function throws an error if arg
is not a numeric vector.
Otherwise, the input is returned invisibly.
Stefan Bundfuss
1 2 3 4 5 6 7 | example_fun <- function(num) {
assert_numeric_vector(num)
}
example_fun(1:10)
try(example_fun(letters))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.