Learn R Programming

pollstR (version 1.0.2)

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
    • slug
    • topic#'
    • short_title
    • poll_count
    • last_updated
    • url
    • 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.

Examples

Run this code
chart1 <- pollstr_chart('2012-virginia-senate-allen-vs-kaine')

Run the code above in your browser using DataLab