Skip to contents

Determines the election procedure each variable corresponds to. In case no election procedure could be determined for a variable, NA_character is returned.

Usage

var_prcd(var_names)

Arguments

var_names

A character vector of FOKUS variable names.

Value

A character vector of the same length as var_names.

Details

Note that the determination is performed by simply parsing var_names.

Examples

fokus::qstnrs |>
  dplyr::mutate(prcd = fokus::var_prcd(variable_name)) |>
  dplyr::filter(!is.na(prcd)) |>
  dplyr::select(variable_name, prcd) |>
  unique()
#> # A tibble: 91 × 2
#>    variable_name                                                        prcd        
#>    <chr>                                                                <chr>       
#>  1 hypothetical_voting_decision_federal_proportional_election_1_party   proportional
#>  2 hypothetical_voting_decision_federal_majoritarian_election_1_seat_1  majoritarian
#>  3 hypothetical_voting_decision_federal_majoritarian_election_1_seat_2  majoritarian
#>  4 hypothetical_voting_decision_cantonal_majoritarian_election_1_seat_1 majoritarian
#>  5 voting_decision_past_federal_proportional_election_1_party           proportional
#>  6 voting_decision_federal_proportional_election_1_party                proportional
#>  7 voting_decision_federal_proportional_election_1_ticket               proportional
#>  8 ticket_modification_federal_proportional_election_1                  proportional
#>  9 ticket_modification_federal_proportional_election_1_cumulated        proportional
#> 10 ticket_modification_federal_proportional_election_1_delisted         proportional
#> # ℹ 81 more rows