Description Usage Arguments Value Author(s) Examples
Checks if an argument is a character vector
1 | assert_character_vector(arg, values = NULL, optional = FALSE)
|
arg |
A function argument to be checked |
values |
A |
optional |
Is the checked parameter optional? If set to |
The function throws an error if arg
is not a character vector or if
any element is not included in the list of valid values. Otherwise, the input
is returned invisibly.
Thomas Neitmann
1 2 3 4 5 6 7 | example_fun <- function(chr) {
assert_character_vector(chr)
}
example_fun(letters)
try(example_fun(1:10))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.