Counts the number of leaf nodes in a tree. This equals the length of the
flat list produced by flatten() on the original structure.
Arguments
- tree
(
RTree)
A tree as returned bybuild_tree().
Examples
tree_size(build_tree(list(a = 1, b = list(c = 2, d = 3))))
#> [1] 3