Keeps only the top-level children whose names match names (in tree
order), reindexing the remaining leaves so they map to contiguous positions
in a flat list.
Arguments
- tree
(
RTree)
A named list tree as returned bybuild_tree().- names
(
character())
Names of children to keep.