Calculates number of seats for the respective parties that have received more than 5% of votes (according to the method of Sainte-Lague/Schepers, see https://www.wahlrecht.de/verfahren/rangmasszahlen.html).
sls(votes, parties, n_seats = 598L)
votes | A numeric vector giving the redistributes votes |
---|---|
parties | A character vector indicating the names of parties with
respective |
n_seats | The total number of seats that can be assigned to the different parties. |
A numeric vector giving the number of seats each party obtained.
library(coalitions) library(dplyr) # get the latest survey for a sample of German federal election polls surveys <- get_latest(surveys_sample) %>% tidyr::unnest("survey") # calculate the seat distribution based on Sainte-Lague/Schepers for a parliament with 300 seats sls(surveys$votes, surveys$party, n_seats = 300)#> [1] 114 72 24 24 27 24 15