View source: R/seat-distribution.R
redistribute | 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 |
get_seats
, sls
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.