dHondt | R Documentation |
Calculates number of seats for the respective parties according to the method of d'Hondt.
dHondt(votes, parties, n_seats = 183)
votes |
Number of votes per party. |
parties |
Names of parties (must be same length as votes). |
n_seats |
Number of seats in parliament. Defaults to 183 (seats in Austrian parliament). |
A numeric vector containing the seats of all parties after redistribution via D'Hondt
sls
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 D'Hondt for a parliament with 300 seats
dHondt(surveys$votes, surveys$party, n_seats = 300)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.