codes2names | R Documentation |
Translates code columns to name columns
codes2names(
.data,
codes_names,
to_name = names(codes_names),
name_suffix = "_name",
code_suffix = "_code"
)
.data |
A data.frame or similar. |
codes_names |
A named (column codes) list of named (codes) vectors (names). For example, from [px_code_name()]. |
to_name |
A vector of column names to be translated to names. Default is the names from 'codes_names'. |
name_suffix |
Suffix to add to name columns. Default is '"_name"'. |
code_suffix |
Suffix to add to code columns. Default is '"_code"'. |
A modified data.frame or similar with '_name' and '_code' suffixes added as specified.
x <- data.frame(a = c("a1", "a2"), b = c("b1", "b2"))
cn <- list(a = c("a1" = "first", "a2" = "second"),
b = c("b1" = "other", "b2" = "something"))
codes2names(x, cn)
codes2names(x, cn, to_name = "a", name_suffix = "_label", code_suffix = "_identifier")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.