Learn R Programming

⚠️There's a newer version (1.1.0) of this package.Take me there.

data.tree

An R package to manage hierarchical data and tree structures

Hierarchical data is ubiquitous in statistics and programming (XML, search trees, family trees, classification, file system, etc.). However, no general-use tree data structure is available in R. Where tabular data has data.frame, hierarchical data is often modeled in lists of lists or similar makeshifts. These structures are often difficult to manage. This is where the data.tree package steps in. It lets you build trees of hierarchical data for various uses: to print, to generate breakdowns, to integrate with html widgets, to rapid prototype search algorithms, to test out new classification ideas, and much more.

The package provides functionality to convert from and to various formats such as data.frames, list of lists, dendrograms, ape phylo, igraph, JSON, YAML, and more.

NOTE:

The latest from github has some breaking changes compared to CRAN. See NEWS for details.

Conventions:

Coding Conventions: Google Style Guide, see https://google-styleguide.googlecode.com/svn/trunk/Rguide.xml

Versioning Conventions: SemanticVersioning. See http://semver.org/ for details

Branching Conventions: GitFlow. See https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow

Pull Requests: Very welcome. Please branch from the dev branch if possible.

Copy Link

Version

Install

install.packages('data.tree')

Monthly Downloads

11,991

Version

0.2.0-3

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Christoph Glur

Last Published

November 12th, 2023

Functions in data.tree (0.2.0-3)

isLeaf

Check if a Node is a leaf
as.Node.phylo

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

Check if a Node is not a leaf
FormatFixedDecimal

Format a Number as a Decimal
NODE_RESERVED_NAMES_CONST

Names that are reserved by the Node class.
Node

Create a data.tree Structure With Nodes
data.tree

data.tree: Hierarchical Data Structures
Clone

Clone a tree (creates a deep copy)
as.phylo.Node

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

Get an attribute from a Node.
Prune

Prunes a tree. This function has side-effects, it modifies your data.tree structure!
as.Node.data.frame

Convert a data.frame to a data.tree structure
Climb

Find a Node by provided criteria.
CreateRegularTree

Create a tree for demo and testing
Do

Executes a function an a set of nodes
Aggregate

Aggregate child values of a Node, standalone or in traversal.
Sort

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

Convert a dendrogram to a data.tree Node
Get

Traverse a Tree and Collect Values
as.list.Node

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

Write a data.tree structure to Newick notation
AreNamesUnique

Test whether all node names are unique.
CreateRandomTree

Create a tree for demo and testing
DefaultPlotHeight

Calculates the height of a Node given the hight of the root.
print.Node

Print a Node in a human-readable fashion.
FormatPercent

Format a Number as a Percentage
Traverse

Traverse a tree or a sub-tree
acme

Sample Data: A Simple Company with Departments
Cumulate

Cumulate values among siblings
Set

Traverse a Tree and Assign Values
isRoot

Check if a Node is the root
mushroom

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

Convert a Node to a dendrogram
Revert

Reverts the sort order of a Node's children.
as.Node.list

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

Convert a data.tree structure to an igraph network
GetPhyloNr

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

Set a formatter function on a specific node
as.Node

Convert an object to a data.tree data structure
isNotRoot

Check if a Node is not a root
as.data.frame.Node

Convert a data.tree structure to a data.frame
ClimbByAttribute

Find a Node by provided criteria.
averageBranchingFactor

Calculate the average number of branches each non-leaf has