Skip to contents

This function retrieves the label of a heading from a labels file.

Usage

get_label(labels_df, variable, type)

Arguments

labels_df

A data frame with three columns: Variable, Label, and Dataset.

variable

The variable for which the label is to be retrieved.

type

The type of the dataset for which the label is to be retrieved.

Value

The label of the heading if it exists in the labels file, otherwise "No label available".

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(LABELS, "USUBJID", "ADPC")  # Returns "Unique Subject Identifier"
 get_label(LABELS, "AGE", "ADPC")  # Returns "No label available"
 } # }