build_tree {yum} | R Documentation |
Convert the objects loaded from YAML fragments into a tree
Description
If the data.tree::data.tree package is installed, this function
can be used to convert a list of objects, as loaded from extracted
YAML fragments, into a data.tree::Node()
.
Usage
build_tree(
x,
idName = "id",
parentIdName = "parentId",
childrenName = "children",
autofill = c(label = "id"),
rankdir = "LR",
directed = "false",
silent = TRUE
)
Arguments
x |
Either a list of YAML fragments loaded from a file with
|
idName |
The name of the field containing each elements' identifier, used to build the data tree when there are references to a parent from a child element. |
parentIdName |
The name of the field containing references to an element's parent element (i.e. the field containing the identifier of the corresponding parent element). |
childrenName |
The name of the field containing an element's children, either as a list of elements, or using the 'shorthand' notation, in which case a vector is supplied with the identifiers of the children. |
autofill |
A named vector where the names represent fields to fill with
the values of the fields specified in the vector values. Note that autofill
replacements are only applied if the fields to be autofilled (i.e. the names of
the vector specified in |
rankdir |
How to plot the plot when it's plotted: the default |
directed |
Whether the edges should have arrows ( |
silent |
Whether to provide ( |
Value
a data.tree::Node()
object.
Examples
loadedYum <- yum::load_yaml_fragments(text=c(
"---",
"-",
" id: firstFragment",
"---",
"Outside of YAML",
"---",
"-",
" id: secondFragment",
" parentId: firstFragment",
"---",
"Also outside of YAML"));
yum::build_tree(loadedYum);