Learn R Programming

pollstR (version 1.2.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
    • titleTitle of the chart.
    • slugSlug (URL-friendly title) of the chart.
    • topicTopic of the chart.
    • short_titleShort title of the chart.
    • poll_countNumber of polls in the chart.
    • last_updatedTime the chart was last updated.
    • urlURL of the chart.
    • estimatesA data frame with an observation for each choice and the current estimates.
    • estimates_by_dateA 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
chart1 <- pollstr_chart('2012-general-election-romney-vs-obama')

Run the code above in your browser using DataLab