Originally an algorithm for proportional allocation of seats to parties in elections, used here to assign the six triangles in each hex to classes.
sainte_lague(votes, nseats)
Vector of 'votes' for each party, non-negative numeric values
Single integer giving the number of seats to be allocated (6, here)
Numeric vector of length nseats
giving the class membership for each seat, with an error
attribute giving the rounding errors for each party.
# NOT RUN {
sainte_lague(c(100,200,300,50),6)
# }
Run the code above in your browser using DataLab