Learn R Programming

oak (version 0.2.3)

subtrees: Subtrees of a tree

Description

The function subtrees returns the list of subtrees of the root of a given tree.

Usage

subtrees(.tree)

# S3 method for rtree subtrees(.tree)

subtrees(x) <- value

Arguments

.tree, x

A tree.

value

Subtrees to be assigned to x.

Value

A (possibly empty) list of trees.

Examples

Run this code
# NOT RUN {
## Rooted tree
(tr0 = c_("Bob", "Carl", "Daniel"))
(tr1 = c_("Bill", "Caroline", "Dimitri", "Enoc"))
(tr2 = r_("Alice", s = list(tr0, tr1)))
(subtrees(tr2))

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

# }

Run the code above in your browser using DataLab