Overview

538’s Generic Ballot polling average (link) is a staple of its election year coverage and forecasting, although it is overshadowed in Presidential election years. The current average, built from the table shown below (note that the columns “election” and “cycle” have been omitted in this rendering), shows that the Democratic party holds a 2.3% advantage over their Republican counterparts.

knitr::opts_chunk$set(echo = TRUE)
library('RCurl')
getdata <- getURL('https://raw.githubusercontent.com/kr0710/Data607/main/generic_ballot_averages.csv')
df <- read.csv(text = getdata)[(3481:3490),-c(6:7)]

Recommendations

It is perhaps less than ideal that the averages for the political parties are in separate rows for a given time point rather than the same row. Reformatting the table further so that the averages for each party are in the same row for each timepoint would be more suitable. Additionally, having the most recent and relevant averages at the top of the table rather than the bottom is a needed change; this is partially accomplished below by subsetting the data to include only the most recent results.

library(knitr)
kable(df)
candidate pct_estimate lo hi date
3481 Democrats 46.89915 44.63127 49.16703 2024-08-30
3482 Republicans 44.63855 42.67855 46.59855 2024-08-30
3483 Democrats 46.75716 44.44934 49.06498 2024-08-29
3484 Republicans 45.27185 43.31185 47.23185 2024-08-29
3485 Democrats 46.58106 44.28175 48.88038 2024-08-28
3486 Republicans 45.27055 43.31055 47.23055 2024-08-28
3487 Democrats 46.71751 44.45093 48.98409 2024-08-27
3488 Republicans 45.24461 43.28461 47.20461 2024-08-27
3489 Democrats 46.76953 44.48868 49.05038 2024-08-26
3490 Republicans 45.18658 43.22658 47.14658 2024-08-26