Given a specific date, extract the survey from this date or the last one before this date.

get_surveys(country = c("DE", "AT"))

get_surveys_by()

get_surveys_rp()

get_surveys_nds()

get_surveys_saxony()

get_surveys_brb()

get_surveys_thuringen()

get_latest(surveys = NULL, max_date = Sys.Date())

Arguments

country

Choose country from which surveys should be scraped. Currently "DE" (Germany) and "AT" (Austria) are supported.

surveys

If provided, latest survey will be obtained from this object, otherwise calls get_surveys.

max_date

Specifies the date, relative to which latest survey will be searched for. Defaults to Sys.Date.

Value

Nested tibble. When fully unnested, the dataset contains the following columns:

pollster

Character name of the polling institute.

date

Publication date of the poll.

start, end

Start and end date of the field period, i.e. the dates during which the poll was conducted.

respondents

Number of respondents in the poll.

party

Character name of an individual party.

percent

Percentage of respondents that chose the party. Given in percentage points, i.e. 38% is given as 38.

votes

Number of respondents that chose the party.

Examples

if (FALSE) { library(coalitions) # scrape data for the German federal election # get_surveys() } library(coalitions) ### Scrape the newest poll for the German federal election # Possibility 1: Calling get_latest without arguments scrapes surveys from the web # Possibility 2: Use get_latest() on an already scraped dataset surveys <- get_latest(surveys_sample)