This function returns a tree in default format (as for
example created using hier_create()
) for objects created using
hier_convert()
.
hier_to_tree(inp)
a nested tree object created using hier_create()
or an object converted with hier_convert()
a nested hierarchy with default format
h <- hier_create(root = "Total", nodes = LETTERS[1:3])
h <- hier_add(h, root = "A", nodes = c("a1", "a5"))
sdc <- hier_convert(h, as = "sdc")
hier_display(h)
#> Total
#> ├─A
#> │ ├─a1
#> │ └─a5
#> ├─B
#> └─C
hier_display(hier_to_tree(h))
#> Total
#> ├─A
#> │ ├─a1
#> │ └─a5
#> ├─B
#> └─C
hier_display(hier_to_tree(sdc))
#> Total
#> ├─A
#> │ ├─a1
#> │ └─a5
#> ├─B
#> └─C