Skip to contents

Drop a node (and all its descendants) from a tree

Usage

drop_node(x, ...)

Arguments

x

The tree to drop nodes from.

node_index

The node to drop.

Value

x, without the specified node and descendants.

Examples

tree() |>
  add_node() |>
  add_node(parent = 1L) |>
  drop_node(2)
#> <dendro::tree>
#>  @ size        : int 1
#>  @ node_indices: int 1
#>  @ next_idx    : int 2
#>  @ root        : int 1
#>  @ nodes       :List of 1
#>  .. $ : <dendro::node>
#>  ..  ..@ index   : int 1
#>  ..  ..@ value   :'data.frame':	0 obs. of  0 variables
#>  ..  ..@ parent  : int NA
#>  ..  ..@ children: int(0) 

tree() |>
  add_node() |>
  add_node(parent = 1L) |>
  drop_node(1)
#> <dendro::tree>
#>  @ size        : int 0
#>  @ node_indices: NULL
#>  @ next_idx    : int 1
#>  @ root        : int NA
#>  @ nodes       : list()