Skip to contents

Counts the number of leaf nodes in a tree. This equals the length of the flat list produced by flatten() on the original structure.

Usage

tree_size(tree)

Arguments

tree

(RTree)
A tree as returned by build_tree().

Value

integer(1)

Examples

tree_size(build_tree(list(a = 1, b = list(c = 2, d = 3))))
#> [1] 3