Skip to contents

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

Usage

var_skill_question_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(skill_question_nr = fokus::var_skill_question_nr(variable_name)) |>
  dplyr::filter(!is.na(skill_question_nr)) |>
  dplyr::select(variable_name, skill_question_nr) |>
  unique()
#> # A tibble: 52 × 2
#>    variable_name                               skill_question_nr
#>    <chr>                                                   <int>
#>  1 skill_question_1_cantonal_proposal_1                        1
#>  2 skill_question_2_cantonal_proposal_1                        2
#>  3 skill_question_3_cantonal_proposal_1                        3
#>  4 skill_question_4_cantonal_proposal_1                        4
#>  5 skill_question_5_cantonal_proposal_1                        5
#>  6 passed_skill_question_1_cantonal_proposal_1                 1
#>  7 passed_skill_question_2_cantonal_proposal_1                 2
#>  8 passed_skill_question_3_cantonal_proposal_1                 3
#>  9 passed_skill_question_4_cantonal_proposal_1                 4
#> 10 passed_skill_question_5_cantonal_proposal_1                 5
#> # ℹ 42 more rows