These objects aren't particularly useful on their own, and are usually
called via add_node()
to automatically assign a unique index.
Usage
node(
index = class_missing,
value = class_missing,
parent = class_missing,
children = class_missing
)
Arguments
- index
The index of the node in the list of nodes stored in the tree object. Calculated automatically when using
add_node()
.- value
Any data or other attributes associated with the node.
- parent
Integer: the index of the node's parent. Only one root node is allowed per tree.
- children
Integer: the index of any children of the node. Leaf nodes should have a value of
NA_integer_
.
Examples
node(0L)
#> <dendro::node>
#> @ index : int 0
#> @ value : list()
#> @ parent : int(0)
#> @ children: int(0)
node(0L, list(a = 2))
#> <dendro::node>
#> @ index : int 0
#> @ value :List of 1
#> .. $ a: num 2
#> @ parent : int(0)
#> @ children: int(0)