Extracts a variable's (common) description from the questionnaire data.
Details
If no ballot_date
and canton
are specified or var_name
is not included at ballot_date
,
variable_label_common
is returned, otherwise
variable_label
. Note that ballot_date
and canton
either must both be NULL
or
set to a valid canton name and ballot date respectively.
See also
Other variable-related functions:
add_vars_to_combos()
,
is_skill_question_var()
,
var_lvls()
,
var_proposal_nr()
,
var_skill_question_nr()
,
var_title()
,
var_val_set()
Examples
# if `ballot_date` and `canton` are not supplied, `variable_label_common` is returned:
fokus::var_lbl("participation_federal")
#> [1] "respondent's participation status regarding the federal proposals/elections of the current ballot (blank votes count as 'participated')"
# otherwise `variable_label`:
fokus::var_lbl(var_name = "participation_federal",
ballot_date = "2018-09-23",
canton = "aargau")
#> [1] "respondent's participation status regarding the federal proposals of the current ballot (blank votes count as 'participated')"
fokus::var_lbl(var_name = "participation_federal",
ballot_date = "2019-10-20",
canton = "aargau")
#> [1] "respondent's participation status regarding the federal elections of the current ballot (blank votes count as 'participated')"