data.tree 0.3 ‘Apple Tree’ on CRAN: Now with tree plot!

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:

To get started with tree data structures, you may want to look at acme, the package sample data.tree structure.

This will print the tree to the console:

To generate a (non-styled) tree plot of the acme sample data, do the following:

This will display a basic tree plot of our sample tree. It looks something like this:

acme tree plot



With a few directives, we can style this to our needs:

acme tree plot with style


Styling is very flexible, yet it takes advantage of the fact that data.tree structures are strictly hierarchical. For example, styling attributes are inherited from parents to children (except inheritance is explicitly set to FALSE).

The release contains also a few fixes and other improvements. See here for the release notes. And if you have questions or want to report a bug, then please do so directly on github. And if you want to get informed about solved issues, new releases, etc., please star the project on github.

So, to frame this post appropriately with yet another apple analogy, let’s close with the following noticeable fact: In the Ulster Cycle, the soul of Cú Roí was confined in an apple that lay in the stomach of a salmon which appeared once every seven years. Not that I know what the Ulster Cycle is, or who in the world Cú Roí was. But it makes a nice story, as we all do hope that the next data.tree release will appear earlier than that!

6 thoughts on “data.tree 0.3 ‘Apple Tree’ on CRAN: Now with tree plot!”

Leave a Reply