Wolfram Function Repository
Instantuse addon functions for the Wolfram Language
Function Repository Resource:
Import polling data on presidential elections from the website FiveThirtyEight
ResourceFunction["FiveThirtyEightPresidentialPollingAverages"][yr] imports presidential polling data from fivethirtyeight.com for the for the specified election year yr.  
ResourceFunction["FiveThirtyEightPresidentialPollingAverages"][{yr_{1},yr_{2},…}] combines data from several election years. 
Get polling data for the 1976 US presidential election from fivethirtyeight.com:
In[1]:= 

Out[1]= 

Retrieve polling data for the 2020 election cycle:
In[2]:= 

Out[2]= 

Get all polling data:
In[3]:= 

Out[3]= 

See the included elections dates:
In[4]:= 

Out[4]= 

See the number of statewide averages for each state or region:
In[5]:= 

Out[5]= 

Use a DateObject to specify the date:
In[6]:= 

Out[6]= 

Get data for two elections:
In[7]:= 

Out[7]= 

In[8]:= 

Out[8]= 

Get all polling data without the current election cycle using "Historic":
In[9]:= 

Out[9]= 

Select data from just one election:
In[10]:= 

Out[10]= 

See the candidates:
In[11]:= 

Out[11]= 

Get the last result for each state:
In[12]:= 

Out[12]= 

Calculate the estimated difference in support between the two candidates:
In[13]:= 

Out[13]= 

Calculate timeline plots for each state:
In[14]:= 

Out[15]= 

Create a map of the support difference which shows the timelines when hovered:
In[16]:= 

Out[16]= 

Get data for another election:
In[17]:= 

Out[17]= 

Create time series data for each state:
In[18]:= 

Out[19]= 

Get the difference in support between the top two candidates over time for each state with over two hundred estimates:
In[20]:= 

Out[20]= 

Create a list of TimeSeries with samples over the smallest common range:
In[21]:= 

Out[21]= 

Calculate the correlations between states:
In[22]:= 

Out[23]= 

See the results:
In[24]:= 

Out[25]= 

Visualize it:
In[26]:= 

Out[254]= 

The 2020 data includes numbers adjusted for convention bounces:
In[255]:= 

Out[256]= 

The bounceadjusted numbers differ considerably from the standard average:
In[257]:= 

Out[257]= 

Use only nonbounceadjusted values instead:
In[258]:= 

Out[258]= 

This work is licensed under a Creative Commons Attribution 4.0 International License