Learn R Programming

data.tree (version 1.2.0)

General Purpose Hierarchical Data Structure

Description

Create tree structures from hierarchical data, and traverse the tree in various orders. Aggregate, cumulate, print, plot, convert to and from data.frame and more. Useful for decision trees, machine learning, finance, conversion from and to JSON, and many other applications.

Copy Link

Version

Install

install.packages('data.tree')

Monthly Downloads

25,175

Version

1.2.0

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Christoph Glur

Last Published

August 25th, 2025

Functions in data.tree (1.2.0)

Navigate

Navigate to another node by relative path.
GetAttribute

Get an attribute from a Node.
Do

Executes a function on a set of nodes
FormatPercent

Format a Number as a Percentage
Get

Traverse a Tree and Collect Values
NODE_RESERVED_NAMES_CONST

Names that are reserved by the Node class.
Node

Create a data.tree Structure With Nodes
GetPhyloNr

Determine the number a Node has after conversion to a phylo object
FormatFixedDecimal

Format a Number as a Decimal
FindNode

Find a node by name in the (sub-)tree
ToNewick

Write a data.tree structure to Newick notation
Revert

Reverts the sort order of a Node's children.
Set

Traverse a Tree and Assign Values
SetFormat

Set a formatter function on a specific node
Sort

Sort children of a Node or an entire data.tree structure
Prune

Prunes a tree.
plot.Node

Plot a graph, or get a graphviz dot representation of the tree
as.Node.BinaryTree

Convert a a SplitNode from the party package to a data.tree structure.
Traverse

Traverse a tree or a sub-tree
acme

Sample Data: A Simple Company with Departments
as.Node.rpart

Convert an rpart object to a data.tree structure
as.Node.dendrogram

Convert a dendrogram to a data.tree Node
as.igraph.Node

Convert a data.tree structure to an igraph network
as.Node.data.frame

Convert a data.frame to a data.tree structure
as.dendrogram.Node

Convert a Node to a dendrogram
as.Node.party

Convert a a party from the partykit package to a data.tree structure.
as.Node.list

Convert a nested list structure to a data.tree structure
as.Node

Convert an object to a data.tree data structure
as.data.frame.Node

Convert a data.tree structure to a data.frame
as.Node.phylo

Convert a phylo object from the ape package to a Node
as.list.Node

Convert a data.tree structure to a list-of-list structure
averageBranchingFactor

Calculate the average number of branches each non-leaf has
isRoot

Check if a Node is the root
isNotRoot

Check if a Node is not a root
mushroom

Sample Data: Data Used by the ID3 Vignette
as.phylo.Node

Convert a Node to a phylo object from the ape package.
isNotLeaf

Check if a Node is not a leaf
isLeaf

Check if a Node is a leaf
print.Node

Print a Node in a human-readable fashion.
s3_register

Register a method for a suggested dependency
data.tree

data.tree: Hierarchical Data Structures
DefaultPlotHeight

Calculates the height of a Node given the height of the root.
AreNamesUnique

Test whether all node names are unique.
Distance

Find the distance between two nodes of the same tree
Aggregate

Aggregate child values of a Node, recursively.
Cumulate

Cumulate values among siblings
CheckNameReservedWord

Checks whether name is a reserved word, as defined in NODE_RESERVED_NAMES_CONST.
CreateRegularTree

Create a tree for demo and testing
Climb

Climb a tree from parent to children, by provided criteria.
CreateRandomTree

Create a tree for demo and testing
Clone

Clone a tree (creates a deep copy)