Replace item value names in a column by their labels
labs_replace(
data,
col,
codes,
col_from = "value_name",
col_to = "value_label",
na.missing = FALSE
)
Tibble with new labels.
A tibble.
The column holding item values.
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
codes <- codebook(data, myitemcolumn)
.
The tidyselect column with source values, defaults to value_name. If the column is not found in the codebook, the first column is used.
The tidyselect column with target values, defaults to value_label. If the column is not found in the codebook, the second column is used
By default, the column is converted to a factor with levels combined from the codebook and the data. Set na.missing to TRUE to set all levels not found in the codes to NA.