Allocate seats proportionally for divisor methods.

highest_averages_method(votes, n_seats, divisors)

Arguments

votes

numeric vector with number of votes for each party

n_seats

total number of seats

divisors

sequence of divisors (length equal to the number of seats). If it is a single number (e.g. 0.5), a sequence is generated starting with it.

Value

The number of seats per party as a vector

Details

The highest averages method requires the number of votes for each party to be divided successively by a series of divisors. This produces a table of quotients, or averages, with a row for each divisor and a column for each party. The nth seat is allocated to the party whose column contains the nth largest entry in this table, up to the total number of seats available. (Wikipedia)

Examples

highest_averages_method(c(5200, 1700, 3100), 15, 0.5)
#> [1] 8 2 5

highest_averages_method(votes = c(50, 0, 30), n_seats = 3,
                        divisors = c(0, 1.3333, 2.4))
#> [1] 2 0 1