These functions will aid in converting one education scheme into another. While you may attempt to go from a low level to a high (from 4 to 9), there is no way to actually do that in a consistent way that will correctly reflect the underlying data.

edu_reduce(x, from, to)

edu9_reduce(x, to = 4)

Arguments

x

character vector

from

factor level to transform from

to

factor level to transform to

Value

factor

Details

Always go from a higher level scheme to a lower one (currently from 9 to 4 only)

Specialized returns

  • edu_reduce - reduce with own to and from specification

  • edu9_reduce - directly reduce from 9 to 4

See also

Examples

edu9 <- c("7", "7", "8", NA, "Primary school (6 years)", "5", "9")
edu_reduce(edu9, 9, 4)
#> [1] University/University college (< 4 years)
#> [2] University/University college (< 4 years)
#> [3] University/University college (> 4 years)
#> [4] <NA>                                     
#> [5] <NA>                                     
#> [6] High school                              
#> [7] University/University college (> 4 years)
#> 4 Levels: Primary school (9 years) ... University/University college (> 4 years)
#> Numeric levels: 9 12 16 19 
edu9_reduce(edu9)
#> [1] University/University college (< 4 years)
#> [2] University/University college (< 4 years)
#> [3] University/University college (> 4 years)
#> [4] <NA>                                     
#> [5] <NA>                                     
#> [6] High school                              
#> [7] University/University college (> 4 years)
#> 4 Levels: Primary school (9 years) ... University/University college (> 4 years)
#> Numeric levels: 9 12 16 19