example_fun <- function(list) {
assert_list_of(list, "data.frame")
}
example_fun(list(mtcars, iris))
try(example_fun(list(letters, 1:10)))
try(example_fun(c(TRUE, FALSE)))
example_fun2 <- function(list) {
assert_list_of(list, "numeric", named = TRUE)
}
try(example_fun2(list(1, 2, 3, d = 4)))
Run the code above in your browser using DataLab