update_rollup {rollupTree} | R Documentation |
Update a rollup from a single leaf vertex
Description
update_rollup()
performs a minimal update of a data set assuming a single leaf element property
has changed. It performs updates along the path from that vertex to the root. There should be no difference
in the output from calling rollup()
again. update_rollup()
is perhaps more efficient and useful in an interactive context.
Usage
update_rollup(tree, ds, vertex, update)
Arguments
tree |
|
ds |
data set to be updated; can be any object |
vertex |
The start vertex |
update |
function called at each vertex as update(ds, parent_key, child_keys) |
Value
updated input data set
Examples
update_rollup(wbs_tree, wbs_table, igraph::V(wbs_tree)["3.2"],
update = function(d, p, c) {
if (length(c) > 0)
d[d$id == p, c("work", "budget")] <-
apply(d[is.element(d$id, c), c("work", "budget")], 2, sum)
d
}
)
[Package rollupTree version 0.3.2 Index]