View source: R/node_methods_sideeffect.R
Sort | R Documentation |
Node
or an entire data.tree
structureYou can sort with respect to any argument of the tree. But note that sorting has side-effects, meaning that you modify the underlying, original data.tree object structure.
Sort(node, attribute, ..., decreasing = FALSE, recursive = TRUE)
node |
The node whose children are to be sorted |
attribute |
determines what is collected. The
|
... |
any parameters to be passed on the the attribute (in case it's a method or a function) |
decreasing |
sort order |
recursive |
if |
Returns the node on which Sort is called, invisibly. This can be useful to chain Node methods.
Node
Revert
data(acme)
acme$Do(function(x) x$totalCost <- Aggregate(x, "cost", sum), traversal = "post-order")
Sort(acme, "totalCost", decreasing = FALSE)
print(acme, "totalCost")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.