By gluc
In Celtic mythology, the apple tree is a symbol for fruitfulness. May data.tree blossom and fructify … and generate that perfect tree plot for us!
The hottest feature of the new release are tree plots: Thanks to the DiagrammeR package, we can now generate beautiful plots in html format. You can include them in RMarkdown documents, web pages, shiny apps, and more. And they may contain interactive tooltips and more.
In case you don’t know what data.tree is: It’s a generic data.structure in R, letting you model and work with hierarchic data with ease. There are two vignettes, walking you through the possibilities offered by the package:
data.tree introduction vignette
sample applications using data.tree
data.tree is useful when converting hierarchic data structures from and to R (e.g. JSON, YAML), for recursive programming algorithms, and much more. For example, the AHP package has been developed with data.tree. Check out the AHP sample application to learn more.
To install the package, simply type the following in R:
install.packages(data.tree)
To get started with tree data structures, you may want to look at acme, the package sample data.tree structure.
library(data.tree) data(acme) print(acme, "p", "cost", expectedCost = function(node) node$p * node$cost)
This will print the tree to the console:
levelName p cost expectedCost
Acme Inc. NA NA NA
¦--Accounting NA NA NA
¦ ¦--New Software ...read moreSource:: r-bloggers.com