Appends rows to the object's alias table: alternative labels by which a
member (frame, unit) is known, tagged with the source the spelling
comes from (a palette, a model's commodity codes, a dataset). The same
alias may legitimately point at several members; scale_match()
reports that as ambiguous unless the caller names the frame.
attach_aliases_scale(x, aliases, source = NULL)A NestedScale.
A data.frame with columns frame, unit, alias and,
unless source is given, source.
Optional single string filled into the source column.
The scale with the rows appended.
s <- attach_aliases_scale(
scale_example(),
data.frame(frame = "sector", unit = c("P", "S"),
alias = c("primary", "secondary")),
source = "labels"
)
scale_match(s, c("Primary", "G1", "nope"))
#> label frame unit method candidates
#> 1 Primary sector P alias <NA>
#> 2 G1 <NA> <NA> ambiguous class/G1; group/G1
#> 3 nope <NA> <NA> none <NA>