Top counties by vote

My previous post got me wondering about the relative number of Democratic and Republican votes in the top counties:

California, Texas, Florida stand out, with LA alone accounting for ~3% of Clinton’s vote. It would be interesting to know how many of those votes were illegal aliens, given that Obama was encouraging illegals to vote. How is requiring proof of citizenship to vote bad for us as a country? I would go further and require not only proof of citizenship, but also proof of high school graduation or the equivalent. Furthermore, lets put an age cap of 75 years on voting. After 75 years you have had 57 years to influence the political direction of our country. Time to step aside and make room for the next generation. Voting is about the future, and at 75 you don’t have much future left. Furthermore cognitive decline may be having an adverse negative effect on decision making. This will also minimize the impact of voting scams that target the elderly.

process.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
##source: https://raw.githubusercontent.com/tonmcg/US_County_Level_Election_Results_08-16/9db796f730956d0a506d51fa653f583a6eef70a3/2016_US_County_Level_Presidential_Results.csv

library(ggplot2)

rm(list=ls(all=TRUE))

# Location of WARN notice pdf file
location <- '~/syncd/prog/county_data'
filename <- paste( "data.csv", sep="")


d <- read.table (file = filename, sep = ",", dec = ".", header=TRUE, skip = 0, na.strings = "NA", strip.white = FALSE )

d$GOPexcess <- d$votes_gop - d$votes_dem
d$winner <- "Trump"
d$county <- NA

for(i in 1:nrow(d)){
if(d[i,"GOPexcess"] <0) d[i,"winner"] <- "Clinton"
d[i,"county"] <- paste(d[i,"county_name"], ", ", d[i,"state_abbr"], sep="" )
}


dem <- d[d$winner=="Clinton",]
dem <- dem[ order(dem$total_votes, decreasing=TRUE),]
toptendem <- dem[1:10,]
toptendem$xlab <- letters[1:10]


gop <- d[d$winner=="Trump",]
gop <- gop[ order(gop$total_votes, decreasing=TRUE),]
toptengop <- gop[1:10,]
toptengop$xlab <- letters[1:10]

d2 <- rbind(toptendem, toptengop)


ggplot(data=d2, aes(x=reorder(xlab, -total_votes), y=total_votes, fill=winner)) + geom_bar(stat="identity") + scale_fill_manual(values=c("blue", "red")) + facet_grid(.~winner) + scale_x_discrete(labels= d2$county) + theme(axis.text.x=element_text(angle = 90, hjust = 0))

Note that I could not figure out how to apply separate x axis labels across facets and had to resort to cut and paste.

Share