R/node_depth.R
node_depth.Rd
Calculate depth of a node in the tree
node_depth(x, ...)
The tree to calculate node depth in.
The index of the node to calculate depth for
The depth of the node as a numeric scalar.
tree() |> add_node() |> add_node(parent = 1L) |> add_node(parent = 2L) |> node_depth(3) #> [1] 3