Skip to contents

Extract nodes from a tree

Usage

get_nodes(x, ...)

Arguments

x

The tree to extract nodes from.

node_indices

The index of nodes to extract from the tree.

Value

A list of nodes.

Examples

tree() |>
  add_node() |>
  add_node(parent = 1L) |>
  add_node(parent = 2L) |>
  get_nodes(c(1, 2))
#> [[1]]
#> <dendro::node>
#>  @ index   : int 1
#>  @ value   :'data.frame':	0 obs. of  0 variables
#>  @ parent  : int NA
#>  @ children: int 2
#> 
#> [[2]]
#> <dendro::node>
#>  @ index   : int 2
#>  @ value   :'data.frame':	0 obs. of  0 variables
#>  @ parent  : int 1
#>  @ children: int 3
#>