hier_rename {sdcHierarchies}R Documentation

Rename nodes in an existing hierarchy

Description

This function allows to rename one or more node(s) (levels) in an existing nested hierarchy.

Usage

hier_rename(tree, nodes)

Arguments

tree

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

nodes

(character) new names of nodes/levels that should be changed as a named vector: names refer to old, existing names, the values to the new labels

Examples

h <- hier_create(root = "Total",  nodes = LETTERS[1:3])
h <- hier_add(h, root = "A", nodes = c("a1", "a5"))
hier_display(h)

h <- hier_rename(h, nodes = c("a1" = "x1", "A" = "X"))
hier_display(h)

[Package sdcHierarchies version 0.21.0 Index]