Skip to contents

Converts referendum data variable names to their ready-for-publication version. Variable names that are unknown, i.e. not present in data_codebook), are left untouched.

Usage

prettify_var_names(var_names)

Arguments

var_names

Variable name(s). Those not present in data_codebook remain untouched. A character vector.

Value

A character vector of the same length as var_names.

See also

Other referendum metadata functions: data_codebook, val_lbls(), val_scale(), var_name_unnested(), var_vals()

Other functions to prettify names: prettify_col_names()

Examples

rdb::prettify_var_names("topics_tier_1")
#> [1] "Top-tier political topics"

# also supports unnested var names
rdb::prettify_var_names("topic_tier_1")
#> [1] "Top-tier political topic"

# unknown var names are left untouched
rdb::prettify_var_names(var_names = c("topic_tier_1", "topic_tier_99"))
#> [1] "Top-tier political topic" "topic_tier_99"