2012 US Election
Mallory Valente
March 28, 2018
Proportion of Women Representatives by State
femaleCongress = (congress)[4]
totalCongress = (congress)[5]
repProp = c(femaleCongress/totalCongress, congress[2])
newData = merge(all_states, repProp, by = "region")
housePlot<- ggplot() +
geom_polygon(data=newData,aes(x=long, y=lat, group = group, fill=representatives), color="grey50") +
coord_map() +
labs(x="",y="",title="Women in the House") +
theme_classic() +
theme(axis.ticks.y = element_blank(), axis.text.y = element_blank(), axis.ticks.x = element_blank(), axis.text.x = element_blank())+
scale_fill_gradient(name="Female Representatives", low="whitesmoke", high="darkred")
housePlot
2012 Election Results of Southern Region
electionData = read_csv("2012.csv")
## Warning: Missing column names filled in: 'X1' [1]
## Parsed with column specification:
## cols(
## X1 = col_character(),
## ObamaVotes = col_integer(),
## ObamaEV = col_integer(),
## RomneyVotes = col_integer(),
## RomneyEV = col_integer(),
## JohnsonVotes = col_integer(),
## JohnsonEV = col_integer(),
## SteinVotes = col_integer(),
## SteinEV = col_integer()
## )
names(electionData)[1] <- "region"
electionData$ObamaPerc <- electionData$ObamaVotes/(electionData$ObamaVotes+electionData$RomneyVotes+electionData$JohnsonVotes+electionData$SteinVotes)
electionData <- merge(all_states, electionData, by="region")
South <- filter(electionData, region %in% c("texas", "oklahoma", "louisiana", "arkansas", "alabama", "georgia", "florida", "mississippi", "tennessee", "kentucky", "south carolina", "north carolina", "virginia", "west virginia", "maryland", "delaware"))
SouthElectionPlot <- ggplot()+geom_polygon(data=South,aes(x=long, y=lat, group = group, fill=ObamaPerc),color="grey50")+coord_map()+labs(x="",y="",title="2012 Election Results")+theme_classic()+ theme(axis.ticks.y = element_blank(),axis.text.y = element_blank(), axis.ticks.x = element_blank(),axis.text.x = element_blank()) + scale_fill_gradient2(name="Obama's Percenatage",low="red",mid="white",high="blue",midpoint=.5)
SouthElectionPlot