This function retrieves the label of a heading from a labels file.
Examples
if (FALSE) { # \dontrun{
# Example usage:
LABELS <- data.frame(
Variable = c("USUBJID", "AVAL"),
Label = c("Unique Subject Identifier", "Analysis Value"),
Dataset = c("ADPC", "ADPC")
)
get_label("USUBJID", "ADPC", LABELS) # Returns "Unique Subject Identifier"
get_label("AGE", "ADPC", LABELS) # Returns "AGE"
# Using a custom mapping column:
LABELS2 <- data.frame(
ColName = c("USUBJID", "AVAL"),
Label = c("Unique Subject Identifier", "Analysis Value"),
Dataset = c("ADPC", "ADPC")
)
get_label("USUBJID", "ADPC", LABELS2)
# Returns "Unique Subject Identifier"
} # }