oak (version 0.2.1)

as.node: Conversion to a node

Description

These methods convert an object to a node. A node is defined as an rtree object with no subtrees.

Usage

as.node(x, ...)

# S3 method for character as.node(x, ...)

# S3 method for tree as.node(x, ...)

Arguments

x

An object to be converted.

...

Additional parameters.

Value

A node.

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)))
as.node(tr2) # the root of 'tr2'

## Unrooted tree
(tr3 = r_(s = list(tr2, c_("Grand-Mother", "Father", "Son"))))
# }
# NOT RUN {
as.node(tr3) # generates an error since 'tr3' is unrooted
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab