# NOT RUN {
data(acme)
acme$Get("level")
acme$Get("totalCount")
calculateAggregateChildCost <- function(node, fun) {
if (node$isLeaf) return(node$cost)
fun(sapply(node$children, function(x) x$averageCost))
}
myFormat <- function(x) {
format(x, nsmall=2, scientific = FALSE)
}
acme$Get(calculateAggregateChildCost,
mean,
traversal = "post-order",
format = myFormat)
#simplify = "regular" will preserve names
acme$Get(function(x) c(position = x$position, level = x$level), simplify = "regular")
# }
Run the code above in your browser using DataLab