oak (version 0.2.1)

leaves: Leaves of a tree

Description

The function leaves returns the leaves of a tree.

Usage

leaves(.tree)

# S3 method for rtree leaves(.tree)

is_leafnode(.node, .tree)

Arguments

.tree

A tree.

.node

A node of .tree.

Value

A (possibly empty) list of nodes.

Examples

Run this code
# NOT RUN {
## Chains
(tr0 = c_("Bob", "Carl", "Daniel"))
leaves(tr0)
(tr1 = c_("Bill", "Caroline", "Dimitri", "Enoc"))
leaves(tr1)

## Rooted tree
(tr2 = r_("Alice", s = list(tr0, tr1)))
leaves(tr2)

## Unrooted tree
(tr3 = r_(s = list(tr2, c_("Grand-Mother", "Father", "Son"))))
leaves(tr3)

# }

Run the code above in your browser using DataLab