View source: R/node_conversion_list.R
as.list.Node | R Documentation |
data.tree
structure to a list-of-list structureConvert a data.tree
structure to a list-of-list structure
## S3 method for class 'Node'
as.list(
x,
mode = c("simple", "explicit"),
unname = FALSE,
nameName = ifelse(unname, "name", ""),
childrenName = "children",
rootName = "",
keepOnly = NULL,
pruneFun = NULL,
...
)
ToListSimple(x, nameName = "name", pruneFun = NULL, ...)
ToListExplicit(
x,
unname = FALSE,
nameName = ifelse(unname, "name", ""),
childrenName = "children",
pruneFun = NULL,
...
)
x |
The Node to convert |
mode |
How the list is structured. "simple" (the default) will add children directly as nested lists.
"explicit" puts children in a separate nested list called |
unname |
If TRUE, and if |
nameName |
The name that should be given to the name element |
childrenName |
The name that should be given to the children nested list |
rootName |
The name of the node. If provided, this overrides |
keepOnly |
A character vector of attributes to include in the result. If |
pruneFun |
allows providing a prune criteria, i.e. a function taking a |
... |
Additional parameters passed to |
data(acme)
str(ToListSimple(acme))
str(ToListSimple(acme, keepOnly = "cost"))
str(ToListExplicit(acme))
str(ToListExplicit(acme, unname = TRUE))
str(ToListExplicit(acme, unname = TRUE, nameName = "id", childrenName = "descendants"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.