Apply variable labels to data frame
Source:R/set_derived_variable_labels.R
set_derived_variable_labels.Rd
Takes labels from the Derived Variables CSV file and applies them to the
passed data frame.
The excel sheet must have columns "df_name"
, "df_label"
, "var_name"
, and "var_label"
.
The returned data frame is also labelled with the value in "df_label"
.
Arguments
- data
Data frame
- df_name
string indicating the name of the data frame to apply labels to. If not specified, we'll do our best to determine the name of the passed data frame.
- path
Path to CSV file
- drop
Logical indicating whether to drop unlabeled variables
Examples
if (FALSE) {
trial %>%
set_derived_variable_labels("derived_variables_sjoberg.xlsx")
}