Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Retrieve US presidential approval data from the website FiveThirtyEight
ResourceFunction["FiveThirtyEightPresidentialApproval"][pres] gives approval rating data from fivethirtyeight.com for the US president pres. | |
ResourceFunction["FiveThirtyEightPresidentialApproval"][pres,prop] gives the property prop. | |
ResourceFunction["FiveThirtyEightPresidentialApproval"][] gives data for the current US president. |
"Latest" | (default) value of latest approval and disapproval averages |
"Aggregates" | average approval data at many times |
"TimeSeries" | TimeSeries objects containing approval averages for different respondent types |
"Polls" | a list of individual polls |
Get the latest presidential approval average from FiveThirtyEight:
In[1]:= |
Out[1]= |
Calculate the net approval:
In[2]:= |
Out[2]= |
Get a Dataset with average approval and disapproval data over time for the current president:
In[3]:= |
Out[3]= |
Specify the president and retrieve the most recent approval value:
In[4]:= |
Out[4]= |
Use a different president:
In[5]:= |
Out[5]= |
For the current president, get time series for each subgroup of respondents and values:
In[6]:= |
Out[6]= |
Plot one of the time series:
In[7]:= |
Out[7]= |
Plot all of the time series in a Dataset:
In[8]:= |
Out[8]= |
Create a labeled plot of all the values for polls of likely and registered voters:
In[9]:= |
Out[9]= |
Get the net approval as a time series:
In[10]:= |
Out[10]= |
See the latest value:
In[11]:= |
Out[11]= |
Plot it:
In[12]:= |
Out[12]= |
Get a dataset for individual polls:
In[13]:= |
Out[13]= |
Limit the results to only a few well-rated pollsters:
In[14]:= |
Out[14]= |
Get the five most recent of these polls:
In[15]:= |
Out[15]= |
Plot timelines for approval values for the six most common pollsters over time:
In[16]:= |
Out[16]= |
See the adjusted values accounting for pollster bias:
In[17]:= |
Out[17]= |
Presidents before Donald Trump are not currently available:
In[18]:= |
Out[18]= |
This work is licensed under a Creative Commons Attribution 4.0 International License