Scrapers

Scrapers for various election polls.

scrape_wahlrecht() scrape_by() scrape_rp() scrape_ltw()

Scrape surveys for German general election

collapse_parties()

Transform surveys in long format

Workflow

Get data, perform simulation, redistribute seats, calculate probabilities.

get_surveys() get_surveys_by() get_surveys_rp() get_surveys_nds() get_surveys_saxony() get_surveys_brb() get_surveys_thuringen() get_latest()

Scrape surveys from all pollsters

pool_surveys()

Obtain pooled survey during specified period

draw_from_posterior()

Draw random numbers from posterior distribution

redistribute()

Calculate percentage of votes/seats after excluding parties with votes < hurdle

have_majority()

Do coalitions have a majority

get_seats()

Calculate seat distribution from draws from posterior

get_probabilities()

Wrapper for calculation of coalition probabilities from survey

calculate_prob()

Calculate coalition probability from majority table

calculate_probs()

Calculate coalition probabilities for multiple coalitions

gg_survey()

Plot voter shares observed in one survey

Seat distribution

Methods used to distribute seats across parties based on voting percentages.

dHondt()

Seat Distribution by D'Hondt

sls()

Seat Distribution by Sainte-Lague/Schepers

hare_niemeyer()

Seat Distribution by Hare/Niemeyer

Data

Built-in datasets and lookup tables.

surveys_sample

Sample of selected surveys

party_colors_de

Colors for German parties

party_labels_de

Labels for German parties

Internal

Internal helper functions.

try_readHTML()

Try call of read_html that throws an error if the url cannot be resolved