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

depth(x)

A vector

An integer.

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