Last chance! 50% off unlimited learning
Sale ends in
Prunes a tree. This function has side-effects, it modifies your data.tree structure!
Prune(node, pruneFun)
The root of the sub-tree to be pruned
a function taking a Node
as an argument, and returning TRUE if the Node
and its descendants should be kept, FALSE otherwise.
the number of nodes removed
# NOT RUN {
data(acme)
Aggregate(acme, "cost", sum, "cost")
acme$Prune(function(x) x$cost > 700000)
print(acme, "cost")
# }
Run the code above in your browser using DataLab