Learn R Programming

SciencesPo (version 1.3.6)

allocation: Seat allocation and its ordering

Description

Compute seat allocation and its ordering for several values of seats and divisor methods with the same quotiens table.

Usage

allocation(parties, votes, seats, method, hurdle = 0)

Arguments

parties
A vector containig the identification of parties or candidates accordingly to the election outcome.
votes
A vector containing the total number of formal votes received by the parties/candidates.
seats
A vector for the number of seats to be filled (the district magnitude).
method
An integer for the method of allocation: method=2 Sainte-Lague; method=1 D'Hondt
hurdle
The percentage of votes that must be reached to get seats in parliament.

Examples

Run this code
# Allocation example:
votes <- sample(1:10000, 5)
allocation(letters[1:5], votes, seats=8, method=1)
allocation(letters[1:5], votes, seats=c(3,5,8), method=2:1, hurdle=0.5)

Run the code above in your browser using DataLab