Determines political level(s) of one or more variables.
Value
A character vector of political levels, of length 0 if no specific levels could be determined.
See also
Other variable-related functions:
add_vars_to_combos()
,
is_skill_question_var()
,
var_election_nr()
,
var_lbl()
,
var_prcd()
,
var_proposal_nr()
,
var_skill_question_nr()
,
var_title()
,
var_val_set()
Examples
fokus::qstnrs |>
dplyr::mutate(lvls = purrr::map(variable_name,
fokus::var_lvls)) |>
dplyr::filter(purrr::map_lgl(lvls,
\(x) length(x) > 0)) |>
dplyr::select(variable_name, lvls) |>
tidyr::unnest_longer(col = lvls,
values_to = "lvl") |>
unique()
#> # A tibble: 374 × 2
#> variable_name lvl
#> <chr> <chr>
#> 1 cantonal_attachment cantonal
#> 2 political_interest_cantonal cantonal
#> 3 voting_decision_federal_proposal_1 federal
#> 4 voting_decision_federal_proposal_2 federal
#> 5 voting_decision_federal_proposal_3 federal
#> 6 voting_decision_cantonal_proposal_1 cantonal
#> 7 importance_cantonal_proposal_1 cantonal
#> 8 affectedness_cantonal_proposal_1 cantonal
#> 9 main_motive_cantonal_proposal_1_yes cantonal
#> 10 main_motive_cantonal_proposal_1_no cantonal
#> # ℹ 364 more rows