On this R-data statistics page, you will find information about the presidentialElections data set which pertains to elections for U.S. President, 1932-2012, by state. The presidentialElections data set is found in the pscl R package. You can load the presidentialElections data set in R by issuing the following command at the console data("presidentialElections"). This will load the data into a variable called presidentialElections. If R says the presidentialElections data set is not found, you can try installing the package by issuing this command install.packages("pscl") and then attempt to reload the data. If you need to download R, you can go to the R project website. You can download a CSV (comma separated values) version of the presidentialElections R data set. The size of this file is about 29,408 bytes.
elections for U.S. President, 1932-2012, by state
Democratic share of the presidential vote, 1932-2012, in each state and the District of Columbia.
statecharacter, name of state
demVotenumeric, percent of the vote for president won by the Democratic candidate
TRUE if state is one of the 11 states of the former Confederacy
1,047 observations, unbalanced panel data in long format. Hawaii and Alaska contribute data from 1960 onwards the District of Columbia contributes data from 1964 onward; Alabama has missing data for 1948 and 1964.
David Leip's Atlas of U.S. Presidential Elections http://uselectionsatlas.org
lattice::xyplot(demVote ~ year | state,
ylab="Democratic Vote for President (percent)",
strip=strip.custom(par.strip.text=list(cex=.6)))## Obama vs Kerry, except DC
y08 <- presidentialElections$year==2008
y04 <- presidentialElections$year==2004
tmpData <- merge(y=presidentialElections[y08,],
tmpData <- tmpData[tmpData$state!="DC",]
xlim <- range(tmpData$demVote.x,tmpData$demVote.y)
col <- rep("black",dim(tmpData))
col[tmpData$south.x] <- "red"plot(demVote.y ~ demVote.x,
xlab="Kerry Vote Share, 2004 (percent)",
ylab="Obama Vote Share, 2008 (percent)",
ols <- lm(demVote.y ~ demVote.x,
legend=c("No Change from 2004","Regression"))
Dataset imported from https://www.r-project.org.