data_label {worcs} | R Documentation |
Label factor variables using metadata
Description
For each column of x
, this function checks whether value
labels exist in value_labels
. If so, integer values are replaced with these
value labels.
Usage
data_label(
x,
variables = names(x),
value_labels = read_yaml(paste0("value_labels_", substitute(x), ".yml"))
)
Arguments
x |
A |
variables |
Column names of |
value_labels |
A list with value labels, typically read from metadata
generated by |
Value
A data.frame
.
Examples
## Not run:
if(interactive()){
labs <- list(x = list(class = "factor", `1` = "a", `2` = "b"))
df <- data.frame(x = 1:2)
data_label(df, value_labels = labs)
}
## End(Not run)
[Package worcs version 0.1.14 Index]