redistribute {coalitions} | R Documentation |
votes < hurdle
Calculate percentage of votes/seats after excluding parties with
votes < hurdle
redistribute(survey, hurdle = 0.05, others = "others", epsilon = 1e-05)
survey |
The actual survey results on which |
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 |
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