Skip to contents

Calculate depth of a node in the tree

Usage

node_depth(x, ...)

Arguments

x

The tree to calculate node depth in.

node_index

The index of the node to calculate depth for

Value

The depth of the node as a numeric scalar.

Examples

tree() |>
  add_node() |>
  add_node(parent = 1L) |>
  add_node(parent = 2L) |>
  node_depth(3)
#> [1] 3