labs_replace {volker} | R Documentation |
Replace item value names in a column by their labels
labs_replace(
data,
col,
codes,
col_from = "value_name",
col_to = "value_label",
relevel = TRUE
)
data |
A tibble. |
col |
The column holding item values. |
codes |
The codebook to use: A tibble with the columns
value_name and value_label.
Can be created by the codebook function, e.g. by calling
|
col_from |
The tidyselect column with source values, defaults to value_name. If the column is not found in the codebook, the first column is used. |
col_to |
The tidyselect column with target values, defaults to value_label. If the column is not found in the codebook, the second column is used |
relevel |
By default, the column is converted to a factor with levels found in the codebook. Other values will be set to NA. Set relevel to FALSE to keep other values. |
Tibble with new labels.