votes_matrix = matrix(c(123,912,312,45,714,255,815,414,215), nrow = 3)
district_seats = c(7,5,8)
party_seats = c(5,11,4)
lower_apportionment(votes_matrix, district_seats, party_seats)
# using "winner take one"
vm = matrix(c(200,100,10,11), 2,
dimnames = list(c("Party A", "Party B"), c("I", "II")))
district_seats = setNames(c(2,1), colnames(vm))
ua = upper_apportionment(vm, district_seats)
lower_apportionment(vm, ua$district, ua$party, method = "wto")
# compare to standard method
lower_apportionment(vm, ua$district, ua$party, method = "round")
Run the code above in your browser using DataLab