label_normalize
removes special characters, whitespace,
and other typical typing errors.
Value
Returns a suggested, normalized label without special characters. The
var_label_normalize
and val_label_normalize
returns them in
snake_case
for programmatic use.
Details
var_label_normalize
and val_label_normalize
removes possible
chunks from question identifiers.
The functions var_label_normalize
and
val_label_normalize
may
be differently implemented for various survey series.
See also
Other variable label harmonization functions:
na_range_to_values()
Other harmonization functions:
collect_val_labels()
,
crosswalk_surveys()
,
crosswalk_table_create()
,
harmonize_na_values()
,
harmonize_survey_values()
,
harmonize_values()
,
harmonize_var_names()
Other harmonization functions:
collect_val_labels()
,
crosswalk_surveys()
,
crosswalk_table_create()
,
harmonize_na_values()
,
harmonize_survey_values()
,
harmonize_values()
,
harmonize_var_names()
Examples
label_normalize (
c("Don't know", " TRUST", "DO NOT TRUST",
"inap in Q.3", "Not 100%", "TRUST < 50%",
"TRUST >=90%", "Verify & Check", "TRUST 99%+"))
#> [1] "do not know" "trust" "do not trust"
#> [4] "inap in q 3" "not 100 pct" "trust lt 50 pct"
#> [7] "trust ge 90 pct" "verify and check" "trust 99 pct plus"
var_label_normalize (
c("Q1_Do you trust the national government?",
" Do you trust the European Commission")
)
#> [1] "do_you_trust_the_national_government"
#> [2] "do_you_trust_the_european_commission"
val_label_normalize (
c("Q1_Do you trust the national government?",
" Do you trust the European Commission")
)
#> [1] "do_you_trust_the_national_government"
#> [2] "do_you_trust_the_european_commission"