
Determine the Depth / Level of Nesting of a List
ldepth.Rdldepth provides the depth of a list or list-like structure.
Arguments
- l
a list.
- DF.as.list
logical.
TRUEtreats data frames like (sub-)lists;FALSElike atomic elements.
Details
The depth or level or nesting of a list or list-like structure (e.g. a model object) is found by recursing down to the bottom of the list and adding an integer count of 1 for each level passed. For example the depth of a data frame is 1. If a data frame has list-columns, the depth is 2. However for reasons of efficiency, if l is not a data frame and DF.as.list = FALSE, data frames found inside l will not be checked for list column's but assumed to have a depth of 1.