hier_delete: Delete nodes from an existing hierarchy

View source: R/hier_delete.R

hier_deleteR Documentation

Delete nodes from an existing hierarchy

Description

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

Usage

hier_delete(tree, nodes)

Arguments

tree

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

nodes

character vector of nodes that should be deleted

Examples

h <- hier_create(root = "Total", nodes = LETTERS[1:2])
h <- hier_add(h, root = "A", nodes = c("a1", "a2"))
h <- hier_add(h, root = "B", nodes = c("b1", "b2"))
h <- hier_add(h, root = "b1", nodes = "b1a")
hier_display(h)

h <- hier_delete(h, nodes = c("a1", "b1a"))
hier_display(h)

sdcHierarchies documentation built on May 29, 2024, 8:01 a.m.