This function allows to add nodes (levels) to an existing nested hierarchy.

hier_add(tree, root, nodes)

Arguments

tree

a (nested) hierarchy created using hier_create() or modified using hier_add(), hier_delete() or hier_rename().

root

(character) a name of an existing node in the hierarchy

nodes

(character) names of new nodes that should be added below "root"

Examples

h <- hier_create(root = "Total", nodes = LETTERS[1:3]) h <- hier_add(h, root = "A", nodes = c("a1", "a5")) hier_display(h)
#> Total #> ├─A #> │ ├─a1 #> │ └─a5 #> ├─B #> └─C