Learn R Programming

pollstR (version 1.2.0)

pollstr_charts: Get list of available charts

Description

Get list of available charts

Usage

pollstr_charts(topic = NULL, state = NULL, showall = NULL,
  convert = TRUE)

Arguments

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.

Value

  • If convert=TRUE, a "pollstr_charts" object with elements [object Object],[object Object] 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
# 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()

Run the code above in your browser using DataLab