New nettskjema data requires codebook to not have special characters, and as such the old and new coding scheme does not fit. This function turns new coding scheme into the old, wanted one
edu_recode(x, names = TRUE)
character vector of old scheme
logical. toggle return of names rather than numbers
character
eds <- c(NA, "UnderGrad_BA", "HighSchool_Initial", "PostGrad_MA",
"PostGrad_PhD", "HighSchool", "Junior-HighSchool", "HighSchool_addition")
edu_recode(eds)
#> [1] NA
#> [2] "Lower level University/University college degree (16 years)"
#> [3] "High school (12 years)"
#> [4] "Upper level University/University college (19 years)"
#> [5] "Ph.D. (21 years)"
#> [6] "High school diploma (13 years)"
#> [7] "Secondary school (9 years)"
#> [8] "High school addition (14 years)"
eds <- c(1,5,8,2,6,9,1,10)
edu_recode(eds, names = FALSE)
#> [1] "Pre-school/No schooling"
#> [2] "High school diploma (13 years)"
#> [3] "Upper level University/University college (19 years)"
#> [4] "Primary school (6 years)"
#> [5] "High school addition (14 years)"
#> [6] "Ph.D. (21 years)"
#> [7] "Pre-school/No schooling"
#> [8] NA