View source: R/node_conversion_dataframe.R
| as.Node.data.frame | R Documentation | 
data.frame to a data.tree structureConvert a data.frame to a data.tree structure
## S3 method for class 'data.frame'
as.Node(
  x,
  ...,
  mode = c("table", "network"),
  pathName = "pathString",
  pathDelimiter = "/",
  colLevels = NULL,
  na.rm = TRUE
)
FromDataFrameTable(
  table,
  pathName = "pathString",
  pathDelimiter = "/",
  colLevels = NULL,
  na.rm = TRUE,
  check = c("check", "no-warn", "no-check"),
  suffix = "_attr"
)
FromDataFrameNetwork(network, check = c("check", "no-warn", "no-check"))
| x | The data.frame in the required format. | 
| ... | Any other argument implementations of this might need | 
| mode | Either "table" (if x is a data.frame in tree or table format) or "network" | 
| pathName | The name of the column in x containing the path of the row | 
| pathDelimiter | The delimiter used to separate nodes in  | 
| colLevels | Nested list of column names, determining on what node levels the attributes are written to. | 
| na.rm | If  | 
| table | a  | 
| check | Either 
 | 
| suffix | optional suffix added to the column name in case the column name is the same as a path element. Defaults to '_attr' | 
| network | A  
 | 
The root Node of the data.tree structure
as.data.frame.Node
Other as.Node: 
as.Node.dendrogram(),
as.Node.list(),
as.Node.phylo(),
as.Node.rpart(),
as.Node()
data(acme)
#Tree
x <- ToDataFrameTree(acme, "pathString", "p", "cost")
x
xN <- as.Node(x)
print(xN, "p", "cost")
#Table
x <- ToDataFrameTable(acme, "pathString", "p", "cost")
x
xN <- FromDataFrameTable(x)
print(xN, "p", "cost")
#More complex Table structure, using colLevels
acme$Set(floor = c(1, 2, 3),  filterFun = function(x) x$level == 2)
x <- ToDataFrameTable(acme, "pathString", "floor", "p", "cost")
x
xN <- FromDataFrameTable(x, colLevels = list(NULL, "floor", c("p", "cost")), na.rm = TRUE)
print(xN, "floor", "p", "cost")
#Network
x <- ToDataFrameNetwork(acme, "p", "cost", direction = "climb")
x
xN <- FromDataFrameNetwork(x)
print(xN, "p", "cost")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.