as.GeneralTree.data.frame: Convert a data frame to a GeneralTree.

Description Usage Arguments Examples

Description

Convert a data frame to a GeneralTree.

Usage

1
2
## S3 method for class '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.

Examples

1
2
3
4
5
  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")

GeneralTree documentation built on Jan. 15, 2017, 6:17 p.m.