Returns the human-readable path for a single leaf identified by its flat
index (e.g. "a$b" or "[[2]]"). Only descends into the branch containing
the target leaf, making it efficient for error reporting.
Arguments
- tree
(
RTree)
A tree as returned bybuild_tree().- i
(
integer(1))
The flat index of the leaf.
Examples
tree_path(build_tree(list(a = 1, b = list(c = 2))), 2L)
#> [1] "b$c"