as.node: Conversion to a node

Description Usage Arguments Value Examples

View source: R/as.node.R

Description

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

Usage

1
2
3
4
5
6
7
as.node(x, ...)

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

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

Arguments

x

An object to be converted.

...

Additional parameters.

Value

A node.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## 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

## End(Not run)

oak documentation built on May 1, 2019, 9:13 p.m.

Related to as.node in oak...