This function allows to add nodes (levels) to an existing nested hierarchy.
hier_add(tree, root, nodes)
a (nested) hierarchy created using hier_create()
or modified using hier_add()
, hier_delete()
or hier_rename()
.
(character) a name of an existing node in the hierarchy
(character) names of new nodes that should be added below
"root"
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