Description Usage Arguments Examples
Convert a data frame to a GeneralTree.
1 2 | ## S3 method for class 'data.frame'
as.GeneralTree(x, ...)
|
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. |
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")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.