Skip to content

Instantly share code, notes, and snippets.

@kszela24
Created May 1, 2016 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kszela24/80e918d59fa2bfde97196d69a2f2eda3 to your computer and use it in GitHub Desktop.
Save kszela24/80e918d59fa2bfde97196d69a2f2eda3 to your computer and use it in GitHub Desktop.
#Subset census data by those making full-time incomes with age >=18.
education_numbers = census[(census$full.or.part.time.employment.stat == "Full-time schedules" &
census$age >= 18),]
#New levels by increasing education
new_levels = c("Children", "Less than 1st grade", "1st 2nd 3rd or 4th grade",
"5th or 6th grade", "7th and 8th grade", "9th grade", "10th grade",
"11th grade", "12th grade no diploma", "High school graduate",
"Associates degree-academic program", "Associates degree-occup /vocational",
"Some college but no degree", "Bachelors degree(BA AB BS)",
"Masters degree(MA MS MEng MEd MSW MBA)", "Doctorate degree(PhD EdD)",
"Prof school degree (MD DDS DVM LLB JD)")
#Refactoring
education_numbers$education = factor(education_numbers$education, levels = new_levels)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment