Using existing data in the MOAS, fills in gaps, converts from on type of coding to another etc.
edu_compute(
data,
edu4 = edu_coded4,
edu9 = edu_coded10,
edu_years = edu_years,
prefix = "edu_",
keep_all = TRUE
)
MOAS-like data
unquoted column containing Education coded in 4 categories
unquoted column containing Education coded in 4 categories
unquoted column containing Education in years to highest completed
string to prefix column names of computed values
logical, append to data.frame
a data.frame
Other edu_functions:
edu_compile()
,
edu_factorise()
,
edu_levels2name()
,
edu_levels()
,
edu_reduce()
,
edu_to_years()
edu <- data.frame(
edu4 = c("3", "High school", 1, NA,
"University/University college (> 4 years)", NA,
"University/University college (< 4 years)"),
edu9 = c(7,7,8,NA,"Primary school (6 years)",5, 9),
edu_years = c(NA, 12, 9, NA, 19, 19, NA),
mother = c("3", "High school", 1, NA,
"University/University college (> 4 years)",
"University/University college (> 4 years)",
"University/University college (< 4 years)"),
father = c(7,7,8,4,"Primary school (6 years)",5, 10),
stringsAsFactors = FALSE
)
edu_compute(edu,
edu4 = edu4,
edu9 = edu9,
edu_years = edu_years)
#> New names:
#> • `edu_years` -> `edu_years...3`
#> • `edu_years` -> `edu_years...8`
#> edu4 edu9
#> 1 3 7
#> 2 High school 7
#> 3 1 8
#> 4 <NA> <NA>
#> 5 University/University college (> 4 years) Primary school (6 years)
#> 6 <NA> 5
#> 7 University/University college (< 4 years) 9
#> edu_years...3 mother
#> 1 NA 3
#> 2 12 High school
#> 3 9 1
#> 4 NA <NA>
#> 5 19 University/University college (> 4 years)
#> 6 19 University/University college (> 4 years)
#> 7 NA University/University college (< 4 years)
#> father
#> 1 7
#> 2 7
#> 3 8
#> 4 4
#> 5 Primary school (6 years)
#> 6 5
#> 7 10
#> edu_coded9
#> 1 Lower level University/University college degree (16 years)
#> 2 Lower level University/University college degree (16 years)
#> 3 Upper level University/University college (19 years)
#> 4 <NA>
#> 5 Primary school (6 years)
#> 6 High school diploma (13 years)
#> 7 Ph.D. (21 years)
#> edu_coded4 edu_years...8
#> 1 University/University college (< 4 years) 16
#> 2 High school 12
#> 3 Primary school (9 years) 9
#> 4 <NA> NA
#> 5 University/University college (> 4 years) 19
#> 6 <NA> 19
#> 7 University/University college (< 4 years) 21