| Do {data.tree} | R Documentation |
Executes a function on a set of nodes
# OO-style:
# node$Do(fun,
# ...,
# traversal = c("pre-order", "post-order", "in-order", "level", "ancestor"),
# pruneFun = NULL,
# filterFun = NULL)
# traditional:
Do(nodes, fun, ...)
nodes |
The nodes on which to perform the Get (typically obtained via |
fun |
the function to execute. The function is expected to be either a Method, or to take a Node as its first argument |
... |
any additional parameters to be passed on to fun |
data(acme) acme$Do(function(node) node$expectedCost <- node$p * node$cost) print(acme, "expectedCost")