sets labels for passed database, Uses the names of final variables in variable_details/variables_sheet as well as the labels contained in the passed dataframes

set_data_labels(data_to_label, variable_details, variables_sheet = NULL)

Arguments

data_to_label

newly transformed dataset

variable_details

variable_details.csv

variables_sheet

variables.csv

Value

labeled data_to_label

Examples

library(cchsflow) library(sjlabelled) bmi2001 <- rec_with_table( cchs2001_p, c( "HWTGHTM", "HWTGWTK", "HWTGBMI_der" ) )
#> No variable_details detected. #> Loading cchsflow variable_details
#> Using the passed data variable name as database_name
#> NOTE for HWTGHTM: 2001 and 2003 CCHS use inches, values converted to meters to 3 decimal points
#> NOTE for HWTGHTM: 74+ inches converted to 76 inches
bmi2003 <- rec_with_table( cchs2003_p, c( "HWTGHTM", "HWTGWTK", "HWTGBMI_der" ) )
#> No variable_details detected. #> Loading cchsflow variable_details
#> Using the passed data variable name as database_name
#> NOTE for HWTGHTM: 2001 and 2003 CCHS use inches, values converted to meters to 3 decimal points
#> NOTE for HWTGHTM: 74+ inches converted to 76 inches
combined_bmi <- bind_rows(bmi2001, bmi2003) get_label(combined_bmi)
#> HWTGHTM HWTGWTK HWTGBMI_der #> "" "" ""
labeled_combined_data <- set_data_labels(combined_bmi, variable_details, variables) get_label(labeled_combined_data)
#> HWTGHTM HWTGWTK HWTGBMI_der #> "Height" "Weight" "Derived BMI"