Learn R Programming

aNCA (version 0.1.0)

get_label: Get the Label of a Heading

Description

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

Usage

get_label(variable, type = "ADNCA", labels_df = metadata_nca_variables)

Value

The label of the heading if it exists in the labels file, otherwise the variable name.

Arguments

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.

labels_df

A data frame containing at least the columns "Variable", "Label", and "Dataset".

Examples

Run this code
 LABELS <- data.frame(
   Variable = c("USUBJID", "AVAL"),
   Label = c("Unique Subject Identifier", "Analysis Value"),
   Dataset = c("ADNCA", "ADNCA")
 )
 get_label("USUBJID", "ADNCA", LABELS)  # Returns "Unique Subject Identifier"
 get_label("AGE", "ADNCA", LABELS)  # Returns "AGE"

Run the code above in your browser using DataLab