Skip to content

Instantly share code, notes, and snippets.

@houshuang
Created May 22, 2013 20:49
Show Gist options
  • Save houshuang/5630775 to your computer and use it in GitHub Desktop.
Save houshuang/5630775 to your computer and use it in GitHub Desktop.
replacelist <- list(
list(c("18-25 years"), "18-25"),
list(c("26-35","26-35 years", "26-45 years", "36-45", "36-45 years"), "26-45"),
list(c("46-65 years", "46-55", "56-65", "56-65 years"), "46-65"),
list(c("66 years or older","66-75", "66-75 years", "76 and over", "76-85", "76-85 years", "86 years or older"), "66 or older"))
for(e in replacelist) {
for(f in e[[1]]) {
db$age <- replacefact(db$age, f, e[[2]])}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment