Pruning refers to removing entire subtrees. This function has side-effects, it modifies your data.tree structure!
Prune(node, pruneFun)the number of nodes removed
data(acme)
acme$Do(function(x) x$cost <- Aggregate(x, "cost", sum))
Prune(acme, function(x) x$cost > 700000)
#> [1] 5
print(acme, "cost")
#> levelName cost
#> 1 Acme Inc. 4950000
#> 2 ¦--Accounting 1500000
#> 3 ¦ °--New Software 1000000
#> 4 °--Research 2750000
#> 5 ¦--New Product Line 2000000
#> 6 °--New Labs 750000