oak (version 0.2.1)

as.list.rtree: Conversion of a tree to a list

Description

This function converts a tree to a list.

Usage

# S3 method for rtree
as.list(x, recursively = FALSE, ...)

Arguments

x

A tree.

recursively

logical. See below.

...

Additional arguments (not used).

Value

A list. If recursively=FALSE, this list is made up of the subtrees of x. If recursively=TRUE, these subtrees are themselves recursively converted to a list.

Examples

Run this code
# NOT RUN {
(tr0 = c_("Bob", "Carl", "Daniel"))
(tr1 = c_("Bill", "Caroline", "Dimitri", "Enoc"))
(tr2 = r_("Alice", s = list(tr0, tr1)))
as.list(tr2)
as.list(tr2, rec = TRUE)

## Unrooted tree
(tr3 = r_(s = list(tr2, c_("Grand-Mother", "Father", "Son"))))
as.list(tr3)
as.list(tr3, rec = TRUE)

# }

Run the code above in your browser using DataLab