Returns the variable label for a single variable in a survey design object,
or NULL if no label has been set.
Arguments
- x
A survey design object (
survey_taylor,survey_replicate, orsurvey_twophase).- var
<
data-masked> Variable name (bare, unquoted).
See also
set_var_label() to set a variable label
Other metadata:
extract_question_preface(),
extract_val_labels(),
extract_var_note(),
infer_question_prefaces(),
set_question_preface(),
set_question_prefaces(),
set_val_labels(),
set_value_labels(),
set_var_label(),
set_var_note(),
set_variable_labels(),
set_variable_notes(),
survey_metadata(),
survey_weighting_history()
Examples
# nhanes_2017 carries haven-style labels auto-extracted by as_survey()
d <- as_survey(nhanes_2017, ids = sdmvpsu, weights = wtint2yr,
strata = sdmvstra, nest = TRUE)
extract_var_label(d, riagendr) # "Gender"
#> [1] "Gender"
extract_var_label(d, ridageyr) # "Age in years at screening"
#> [1] "Age in years at screening"