The depth of a vector is basically how many levels that you can index into it.

depth(x)

Arguments

x

A vector

Value

An integer.

Examples

x <- list( list(), list(list()), list(list(list(1))) ) depth(x)
#> [1] 5
x %>% map_int(depth)
#> [1] 1 2 4