This function adds "label" attributes to all columns in a dataset
Value
The same dataset with label attributes applied to all columns. If a column is not present in the labels list, it will be assigned the name of the col.
Examples
if (FALSE) { # \dontrun{
# Example usage:
data <- data.frame(USUBJID = c(1, 2, 3), AVAL = c(4, 5, 6))
labels <- data.frame(
Variable = c("USUBJID", "AVAL"),
Label = c("Unique Subject Identifier", "Analysis Value")
)
data <- apply_labels(data, labels)
print(attr(data$A, "label"))
} # }