# NOT RUN {
x <- recode(infert, case, 0/"No", 1/"Yes")
tab(x, case)
# }
# NOT RUN {
## recode a factor
x <- recode(infert, education, "0-5yrs"/1, "6-11yrs"/2, "12+ yrs"/3)
tab(x, education)
## recode numeric vectors
x <- recode(infert, age, 21:28.9/1, 29:34.9/2, 35:44/3)
tab(x, age)
## recode NA
infert[4:20, "case"] <- NA
x <- recode(infert, case, NA/"Missing value")
tab(infert, case)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab