The function pollster_api is the lower-level function for making a request to the Huffpost Pollster API. There is also a function for each methods provided by the API.

pollster_api(path, query = NULL, version = "v2", response_type = NULL,
  as = "parsed", ...)

pollster_polls(cursor = NULL, tags = NULL, question = NULL,
  sort = c("created_at", "updated_at"), ...)

pollster_polls_slug(slug, ...)

pollster_questions(cursor = NULL, tags = NULL, election_date = NULL, ...)

pollster_questions_slug(slug, ...)

pollster_questions_responses_clean(slug, ...)

pollster_questions_responses_raw(slug, ...)

pollster_charts(cursor = NULL, tags = NULL, election_date = NULL, ...)

pollster_charts_slug(slug, ...)

pollster_charts_polls(slug, ...)

pollster_charts_trendlines(slug, ...)

pollster_tags(...)

Arguments

path
The API endpoint, as a character vector. If the length is greater than one, the elements will be collapsed and separated by "/".
query
Query parameters as a list.
version
The API version.
response_type
Response content type. One of "json", "tsv", or "xml". Some endpoints are json/xml, and some are tsv.
as
Passed to content.
...
Arguments passed to GET.
cursor
Special string used to handle pagination.
tags
Character vector of tag names.
question
Question slug.
sort
Sort order of polls.
slug
Unique identifier for the poll or question or chart.
election_date
A date object or a string in "YYYY-MM-DD" format for the election date.

Value

A pollster_api object which is a list with elements

  • content:The parsed content of the response,
  • url:The URL of the request,
  • response:The request object returned by GET.

Functions