powered by
Weight votes by dividing the votes matrix entries by the number of seats per district. Votes in districts without seats are set to zero.
weight_votes_matrix(votes_matrix, district_seats)weight_list_votes(votes_matrix, district_seats)
weight_list_votes(votes_matrix, district_seats)
The weighted votes_matrix with the number of voters (not rounded).
votes_matrix
Votes matrix
Seats per district, vector with same length as ncol(votes_matrix) and names as colnames(votes_matrix)
ncol(votes_matrix)
colnames(votes_matrix)
This method is used in upper_apportionment() if weight_votes is TRUE (default).
upper_apportionment()
weight_votes
TRUE
(vm <- matrix(c(20, 10, 8, 5), nrow = 2)) weight_votes_matrix(vm, c(3, 2)) weight_votes_matrix(uri2020$votes_matrix, uri2020$seats_vector)
Run the code above in your browser using DataLab