Description Usage Arguments Examples
This function aggregates multiple attribute variables from children nodes to their corresponding parent node simultaneously using a specific function
1 2 3 4 5 6 | Aggregate.dt(
tree,
...,
aggfun,
traversal = c("pre-order", "post-order", "in-order", "level", "ancestor")
)
|
tree |
the data tree object |
... |
the attribute variables to be aggregated for each node |
aggfun |
the aggregation function to be applied to each node's attributes |
traversal |
traversal order: any of 'pre-order' (the default), 'post-order', 'in-order', 'level', 'ancestor', or a custom function |
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## Not run:
# create a data tree object
data(employee)
employee.tree = createTree(employee, "Employee Information",
c("Department", "JobRole", "EmployeeNumber"))
# aggregate the mean of monthly income for each node recursively
# to its corresponding parent node in post-order, upto the root node
Aggregate.dt(employee.tree, "MonthlyIncome",
aggfun = function(x) mean(x, na.rm = TRUE),
traversal = "post-order")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.