Determines the election number each variable corresponds to. In case no election number could be determined for a variable, NA_character
is returned.
See also
Other variable-related functions:
add_vars_to_combos()
,
is_skill_question_var()
,
var_lbl()
,
var_lvls()
,
var_prcd()
,
var_proposal_nr()
,
var_skill_question_nr()
,
var_title()
,
var_val_set()
Examples
fokus::qstnrs |>
dplyr::mutate(election_nr = fokus::var_election_nr(variable_name)) |>
dplyr::filter(!is.na(election_nr)) |>
dplyr::select(variable_name, election_nr) |>
unique()
#> # A tibble: 91 × 2
#> variable_name election_nr
#> <chr> <int>
#> 1 hypothetical_voting_decision_federal_proportional_election_1_party 1
#> 2 hypothetical_voting_decision_federal_majoritarian_election_1_seat_1 1
#> 3 hypothetical_voting_decision_federal_majoritarian_election_1_seat_2 1
#> 4 hypothetical_voting_decision_cantonal_majoritarian_election_1_seat_1 1
#> 5 voting_decision_past_federal_proportional_election_1_party 1
#> 6 voting_decision_federal_proportional_election_1_party 1
#> 7 voting_decision_federal_proportional_election_1_ticket 1
#> 8 ticket_modification_federal_proportional_election_1 1
#> 9 ticket_modification_federal_proportional_election_1_cumulated 1
#> 10 ticket_modification_federal_proportional_election_1_delisted 1
#> # ℹ 81 more rows