Skip to contents

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

Usage

var_proposal_nr(var_names)

Arguments

var_names

A character vector of FOKUS variable names.

Value

An integer vector of the same length as var_names.

Details

Note that the determination is performed by simply parsing var_names.

See also

Examples

fokus::qstnrs |>
  dplyr::mutate(proposal_nr = fokus::var_proposal_nr(variable_name)) |>
  dplyr::filter(!is.na(proposal_nr)) |>
  dplyr::select(variable_name, proposal_nr) |>
  unique()
#> # A tibble: 181 × 2
#>    variable_name                       proposal_nr
#>    <chr>                                     <int>
#>  1 voting_decision_federal_proposal_1            1
#>  2 voting_decision_federal_proposal_2            2
#>  3 voting_decision_federal_proposal_3            3
#>  4 voting_decision_cantonal_proposal_1           1
#>  5 importance_cantonal_proposal_1                1
#>  6 affectedness_cantonal_proposal_1              1
#>  7 main_motive_cantonal_proposal_1_yes           1
#>  8 main_motive_cantonal_proposal_1_no            1
#>  9 difficulty_cantonal_proposal_1                1
#> 10 decision_moment_cantonal_proposal_1           1
#> # ℹ 171 more rows