list_depth

0th

Percentile

Get the depth of a list

Gets the depth of a list (at its deepest point).

Usage
list_depth(l, prune_empty_elts = FALSE)
Arguments
l
A variable, probably a list.
prune_empty_elts
A logical value. Should empty elements be pruned without counting them?
Value

A non-negative integer of the deepest depth of the list.

See Also

This is loosely based upon list.depth (internal to older versions of the Zelig package), but gives different answers.

Aliases
  • list_depth
Examples
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)
Documentation reproduced from package listless, version 0.0-2, License: GPL-3

Community examples

Looks like there are no examples yet.