The input with labelled variables converted to character. For
single vector input, returns a character vector.
Arguments
data
A data frame, tibble, or a single vector.
...
Optional: unquoted variable names (tidyselect supported). If
empty, converts all haven_labelled columns.
drop_na
If TRUE (default), tagged NAs become regular NA.
add_non_labelled
If TRUE, unlabelled values are included as
their numeric string representation. Default: FALSE.
drop.na, add.non.labelled
Defunct dot-case argument names, removed
in mariposa 0.6.9. Calling the function with any of them is an error;
use the snake_case equivalents instead. (The formals are retained only
so that the old names error clearly instead of being swallowed by
....)
Details
This is a convenience wrapper around to_label() that calls
as.character() on the result. Use this when you need character output
(e.g., for string operations) rather than factor output.
The variable label ("label" attribute) is preserved on the output.
# Convert a single variable to characterto_character(survey_data$gender)
# Convert specific columns in a data framedata <- to_character(survey_data, gender, region)