var_lvls: Determine variable's political level(s)

var_lvlsR Documentation

Determine variable's political level(s)

Description

Determines political level(s) of one or more variables.

Usage

var_lvls(var_names)

Arguments

var_names

A character vector of FOKUS variable names.

Details

Note that the political levels are determined by simply parsing var_names.

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()

zdaarau/fokus documentation built on Dec. 24, 2024, 10:47 p.m.