example_fun <- function(chr) {
assert_character_vector(chr)
}
example_fun(letters)
try(example_fun(1:10))
example_fun2 <- function(chr) {
assert_character_vector(chr, named = TRUE)
}
try(example_fun2(c(alpha = "a", "b", gamma = "c")))
Run the code above in your browser using DataLab