Strips all label-related attributes from variables, converting
haven_labelled vectors to their base R types (numeric or character).
This is useful when you need plain data without any labelling for
functions or packages that do not support labelled data.
Usage
unlabel(data, ...)
Value
The data with all labelling removed. haven_labelled numeric
vectors become plain double, factors remain factors (but lose their
"label" attribute).
Arguments
data
A data frame, tibble, or a single vector.
...
Optional: unquoted variable names (tidyselect supported). If
empty, applies to all columns.
Details
The following attributes are removed:
"label" (variable label)
"labels" (value labels)
"na_tag_map" (tagged NA mapping)
"na_tag_format" (tagged NA format)
"na_values", "na_range" (SPSS missing value specs)
# Remove all labels from the entire datasetdata_plain <- unlabel(survey_data)
# Remove labels from specific variables onlydata <- unlabel(survey_data, gender, life_satisfaction)