This function returns a data.table that maps original
and default codes.
hier_match(tree, nodes = NULL, inputs = "orig")an input derived from hier_create() or
hier_convert()
NULL or a character vector specifying either
original node names or standardized default codes. If
NULL, the information is returned for all nodes.
(character) specifies what kind of node names are
provided in argument nodes. Allowed choices are:
"orig": argument nodes refers to original node names
"default": argument nodes refers to standardized
default codes
a data.table with the following columns:
"orig": the original node names
`"default": the standardized names
"is_bogus": TRUE if the code is a "bogus" (duplicated)
node.
h <- hier_create(root = "Tot", nodes = letters[1:5])
h <- hier_add(h, root = "a", nodes = "a0")
h2 <- hier_convert(tree = h, as = "dt")
hier_match(tree = h, nodes = c("a", "b"), inputs = "orig")
#> orig default is_bogus
#> <char> <char> <lgcl>
#> 1: a 01 FALSE
#> 2: b 02 FALSE
hier_match(tree = h2, nodes = c("01", "02"), inputs = "default")
#> orig default is_bogus
#> <char> <char> <lgcl>
#> 1: a 01 FALSE
#> 2: b 02 FALSE