to_haven_y2 | R Documentation |
Convert a character or factor vector into a dbl labelled (haven labelled) vector. Useful for when you need to either extract labels or attach underlying numbers to each label
to_haven_y2(variable)
variable |
The vector or variable within a data frame that you wish to convert to haven labelled |
test <- tibble::tibble(
color_factor = c('Blue', 'Blue', 'Red', 'Yellow') %>%
forcats::as_factor()
)
test$color <- to_haven_y2(test$color_factor)
test <- test %>%
dplyr::mutate(
color = to_haven_y2(color_factor)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.