Learn R Programming

pollstR (version 1.3.0)

pollstr_chart: Return a single chart

Description

Return a single chart. This includes both current and historical estimates by date.

Usage

pollstr_chart(slug, convert = TRUE)

Arguments

slug
The slug-name of the chart to be returned.
convert
Rearrange the data returned by the API into easier to use data frames.

Value

If convert=TRUE, then a "pollstr_chart" object with elements
  • title Title of the chart.
  • slug Slug (URL-friendly title) of the chart.
  • topic Topic of the chart.
  • short_title Short title of the chart.
  • poll_count Number of polls in the chart.
  • last_updated Time the chart was last updated.
  • url URL of the chart.
  • estimates A data frame with an observation for each choice and the current estimates.
  • estimates_by_date A data frame with an observation for each choice at each date, with estimates.
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: 
# chart1 <- pollstr_chart('2012-general-election-romney-vs-obama')
# ## End(Not run)

Run the code above in your browser using DataLab