| vec_is_list {vctrs} | R Documentation |
vec_is_list() tests if x is considered a list in the vctrs sense. It
returns TRUE if:
x is a bare list with no class.
x is a list explicitly inheriting from "list".
list_all_vectors() takes a list and checks that all elements of
x are vectors.
vec_check_list() and list_check_all_vectors() throw a type
error if the input is not a list as defined by vec_is_list() and
list_all_vectors() respectively.
vec_is_list(x)
vec_check_list(x, ..., arg = caller_arg(x), call = caller_env())
list_all_vectors(x)
list_check_all_vectors(x, ..., arg = caller_arg(x), call = caller_env())
x |
An object. |
... |
These dots are for future extensions and must be empty. |
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. |
Notably, data frames and S3 record style classes like POSIXlt are not considered lists.
vec_is_list(list())
vec_is_list(list_of(1))
vec_is_list(data.frame())
list_all_vectors(list(1, mtcars))
list_all_vectors(list(1, environment()))
# `list_`-prefixed functions assume a list:
try(list_all_vectors(environment()))