edu_compile | R Documentation |
Compiles education from participant, mother or father depending on source availability. Made for ease of testing and reporting education SES of family
edu_compile(data, participant, mother, father)
data |
MOAS-like data.frame |
participant |
unquoted column of 4 category education for participant |
mother |
unquoted column of 4 category education for participant's mother |
father |
unquoted column of 4 category education for participant's father |
dataframe with three new columns
Other edu_functions:
edu_compute()
,
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
)
library(dplyr)
edu %>%
mutate(
mother = ifelse(mother == "3", NA, mother),
mother = edu4_factorise(mother),
father = edu9_reduce(edu9_factorise(father))
) %>%
edu_compile(
participant = edu4,
mother = mother,
father = father
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.