Learn R Programming

pollstR (version 1.3.0)

pollstr_charts: Get list of available charts

Description

Get list of available charts

Usage

pollstr_charts(page = 1, topic = NULL, state = NULL, showall = NULL, convert = TRUE, max_pages = 1)

Arguments

page
Return page number
topic
Only include charts related to a specific topic. See http://elections.huffingtonpost.com/pollster/api for examples.
state
Only include charts from a single state. Use 2-letter state abbreviations. "US" will return all national charts.
showall
logical Include charts for races that were once possible but didn't happen (e.g. Gingrich vs. Obama 2012)
convert
Rearrange the data returned by the API into easier to use data frames.
max_pages
Maximum number of pages to get.

Value

If convert=TRUE, a "pollstr_charts" object with elements
charts
Data frame with data on charts.
estimates
Data frame with current estimates from each chart. The column slug matches this data frame to charts
Otherwise, a "list" in the original structure of the json returned by the API.

References

http://elections.huffingtonpost.com/pollster/api

Examples

Run this code
## Not run: 
#  # Get charts related to Washington
#  wa <- pollstr_charts(state='WA')
#  # Get national charts
#  us_charts <- pollstr_charts(state='US')
#  # Get charts in the topic '2016-president'
#  gov <- pollstr_charts(topic='2016-president')
#  # Get all charts
#  allcharts <- pollstr_charts()
# ## End(Not run)

Run the code above in your browser using DataLab