Skip to content

Instantly share code, notes, and snippets.

@dggoldst
Last active April 15, 2016 20:18
Show Gist options
  • Save dggoldst/8b3fa30c600dad9f97cbc0687cfbde43 to your computer and use it in GitHub Desktop.
Save dggoldst/8b3fa30c600dad9f97cbc0687cfbde43 to your computer and use it in GitHub Desktop.
library(dplyr)
library(xtable)
#HC01_EST_VC17
#Total; Estimate; Percent bachelor's degree or higher
#HC01_EST_VC14
#Total; Estimate; Population 25 years and over - Graduate or professional degree
#Note: I stripped out a second header line in preproc
df <- read.csv("ACS_14_1YR_S1501.csv")
#Keep only the necessary columns, give readable names
df=df %>% select(GEO.display.label, HC01_EST_VC17, HC01_EST_VC14)
names(df)=c("County","Bachelors_or_Higher","Grad_Degree")
#Make a small data frame sorted by grad degree
sdf = data.frame(
df %>% arrange(desc(Grad_Degree)) %>% select(County, Grad_Degree)
)[1:25,]
print(xtable(sdf), type="html")
#Make a small data frame sorted by Bachelors or higher
sdf= data.frame(
df %>% arrange(desc(Bachelors_or_Higher)) %>% select(County, Bachelors_or_Higher)
)[1:25,]
print(xtable(sdf), type="html")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment