Description Usage Arguments Value See Also Examples
Gets the depth of a list (at its deepest point).
1 | list_depth(l, prune_empty_elts = FALSE)
|
l |
A variable, probably a list. |
prune_empty_elts |
A logical value. Should empty elements be pruned without counting them? |
A non-negative integer of the deepest depth of the list.
This is loosely based upon list.depth
(internal to older
versions of the Zelig
package), but gives different answers.
1 2 3 4 5 6 7 8 9 | list_depth(list(1))
list_depth(list(1, list(2:3, 4:6)))
# Atomic variables have depth 0
list_depth(1)
# Empty elements can be pruned before counting
list_depth(list())
list_depth(list(), prune_empty_elts = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.