Skip to contents

Extracts a variable's (common) description from the questionnaire data.

Usage

var_lbl(var_name, ballot_date = NULL, canton = NULL)

Arguments

var_name

Variable name. A character scalar.

ballot_date

NULL or a FOKUS-covered ballot date, i.e. one of

  • "2018-09-23"

  • "2018-11-25"

  • "2019-10-20"

  • "2020-09-27"

  • "2020-10-18"

  • "2021-11-28"

  • "2023-06-18"

  • "2024-10-20"

canton

NULL or a FOKUS-covered canton name, i.e. one of

  • "aargau"

Value

A character scalar.

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

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')"