| labelled_spss_survey_coercion | R Documentation |
Convert labelled SPSS-style survey vectors to common R data types. These helpers provide consistent coercion behavior for '"retroharmonize_labelled_spss_survey"' objects while respecting labelled missing values.
as_numeric(x)
as_character(x)
as_factor(x, levels = "default", ordered = FALSE)
x |
A labelled survey vector created with [labelled_spss_survey()]. |
levels |
Character string indicating how factor levels should be constructed. Currently retained for compatibility. |
ordered |
Logical; whether the resulting factor should be ordered. Currently ignored. |
* 'as_numeric()' returns a numeric vector with labelled missing values converted to 'NA'. * 'as_character()' returns a character vector based on the factor representation of 'x'. * 'as_factor()' returns a factor with levels derived from value labels.
[labelled_spss_survey()], [haven::as_factor()]
Other type conversion functions:
as_labelled_spss_survey()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.