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" or "vctrs_list_of".

  • x is an S3 list that vec_is() returns TRUE for. For this to return TRUE, the class must implement a vec_proxy() method.

vec_is_list(x)

Arguments

x

An object.

Details

Notably, data frames and S3 record style classes like POSIXlt are not considered lists.

Examples

vec_is_list(list())
#> [1] TRUE
vec_is_list(list_of(1))
#> [1] TRUE
vec_is_list(data.frame())
#> [1] FALSE