# Factor -> haven_labelled
x <- factor(c("Male", "Female", "Male"))
to_labelled(x)
# Numeric with custom labels
to_labelled(c(1, 2, 3),
labels = c("Low" = 1, "Medium" = 2, "High" = 3),
label = "Satisfaction level"
)
# All factors in a data frame
data <- to_labelled(survey_data)
Run the code above in your browser using DataLab