Convert a data frame to a GeneralTree.

Usage

# S3 method for data.frame
as.GeneralTree(x, ...)

Arguments

x
The data frame that should be converted to a tree.
...
id The column name of the column that holds the ids of each node. data The column name of the column that holds the data of each node. parent The column name of the column that holds the parent of each node, NA indicates a node is the root.

Description

Convert a data frame to a GeneralTree.

Examples

test_tree_df <- data.frame( ID = c("root", "child1", "child2", "child3"), DATA = c("parent1", "data3.1", "data1.2", "data1.3"), PARENT = c(NA, "child3", "root", "root"), stringsAsFactors = FALSE) as.GeneralTree(test_tree_df, id = "ID", data = "DATA", parent = "PARENT")
root : parent1 --> child3 : data1.3 --> child1 : data3.1 \-> child2 : data1.2