View source: R/biproportional-wto.R
| district_winner_matrix | R Documentation |
Create a logical matrix that shows whether a party got the most votes in a district or not.
district_winner_matrix(votes_matrix, district_seats = 1L)
votes_matrix |
Vote count matrix with votes by party in rows and votes by district in columns. |
district_seats |
Vector defining the number of seats per district. Must be the same
length as |
If two or more parties are tied and there are not enough seats for each tied party,
the matrix value is NA.
logical matrix with the same dimensions and names as votes_matrix
(vm = matrix(c(60,30,0,20,10,30), nrow = 3, dimnames = list(1:3, c("A", "B"))))
district_winner_matrix(vm)
# NA values if parties are tied (here in district B)
vm[1,2] <- 30
district_winner_matrix(vm)
# No NA values for tied parties if enough seats are available
district_winner_matrix(vm, c(1, 2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.