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())
country | Choose country from which surveys should be scraped.
Currently |
---|---|
surveys | If provided, latest survey will be obtained from this object,
otherwise calls |
max_date | Specifies the date, relative to which latest survey will
be searched for. Defaults to |
Nested tibble. When fully unnested, the dataset contains the following columns:
Character name of the polling institute.
Publication date of the poll.
Start and end date of the field period, i.e. the dates during which the poll was conducted.
Number of respondents in the poll.
Character name of an individual party.
Percentage of respondents that chose the party. Given in
percentage points, i.e. 38%
is given as 38
.
Number of respondents that chose the party.
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)