redistribute: Calculate percentage of votes/seats after excluding parties...

View source: R/seat-distribution.R

redistributeR Documentation

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

Description

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

Usage

redistribute(survey, hurdle = 0.05, others = "others", epsilon = 1e-05)

Arguments

survey

The actual survey results on which dirichlet.draws were based on.

hurdle

The percentage threshold which has to be reached by a party to enter the parliament. Any party called "ssw" will be exempt from the hurdle.

others

A string indicating the name under which parties not listed explicitly are subsumed.

epsilon

Percentages should add up to 1. If they do not, within accuracy of epsilon, an error is thrown.

See Also

get_seats, sls

Examples

library(coalitions)
library(dplyr)
# get the latest survey for a sample of German federal election polls
surveys <- get_latest(surveys_sample)
# redistribute the shares of 'others' parties and parties with a share of under 5\%
surveys <- surveys %>% mutate(survey_redist = purrr::map(survey, redistribute))
surveys$survey # results before redistribution
surveys$survey_redist # results after redistribution

coalitions documentation built on Aug. 17, 2022, 5:07 p.m.