Political piece here.
# Super Tuesday 2016 Code.Data from:
# http://www.presidency.ucsb.edu/showelection.php?year=2012
# http://www.theguardian.com/us-news/2016/mar/01/super-tuesday-trump-clinton-sanders-cruz-rubio
library(lattice)
library(data.table)
t1 <- data.table(read.csv("PrimaryResultsST03.02.2016.csv"))
setkey(t1,State)
t1 <- with(t1,cbind(t1,"RepP_DemP"=RepPri-DemPri,"Romney_Obama"=Romney-Obama,"TV2012_Pri2016"=TV2012-(DemPri + RepPri)))
t1
t2 <- colSums(data.frame(t1)[,2:12],na.rm=TRUE)
as.matrix(t2)
barchart(~DemPri + RepPri| State,data=t1,col=c("blue","red"),xlab="RepPrimary,DemPrimary")
barchart(~Obama + Romney| State,data=t1,col=c("blueviolet","salmon"),xlab="Romney,Obama")
barchart(~DemPri + RepPri + Obama + Romney| State,data=t1,col=c("blue","red","blueviolet","salmon"),xlab="Romney,Obama,RepPrimary,DemPrimary")
No comments:
Post a Comment