Turn education data to years

edu_to_years(x, levels)

edu4_to_years(x)

edu9_to_years(x)

Arguments

x

character vector

levels

levels returned from the edu_levels() function

Value

vector of integers

Details

Specialized returns

  • edu_to_years - Alter education to years specifying number of levels

  • edu4_to_years - directly alter 4-level coded education to years

  • edu9_to_years - directly alter 9-level coded education to years

See also

Examples


edu4 <- c("3", "High school", "1", NA, 
          "University/University college (> 4 years)", 
           NA, "University/University college (< 4 years)")

edu_to_years(edu4, 4)
#> [1] 16 12  9 NA 19 NA 16
edu4_to_years(edu4)
#> [1] 16 12  9 NA 19 NA 16

edu9 <- c("7", "7", "8", NA, "Primary school (6 years)", "5", "9")
edu_to_years(edu9, 9)
#> [1] 16 16 19 NA  6 13 21
edu9_to_years(edu9)
#> [1] 16 16 19 NA  6 13 21