roundp | R Documentation |
Round proportions so they sum to one (or allocate seats from election results).
roundp(x, digits = NULL, seats = NULL, method = "SL",
labels = names(x))
x |
a vector containing proportions (or votes from an election). |
digits |
a number of decimals to use when rounding proportions, max 6. |
seats |
the number of seats to allocate from election results. |
method |
|
labels |
an optional vector of labels. |
Numeric vector of same length as x
, with rounded proportions whose sum
is 1 (or integers whose sum is seats
).
This function should be called either with a digits
argument, or with
a seats
argument, not both.
The algorithms were designed to allocate seats from elections:
"DH" | (D'Hondt) favors big parties - used in most of Europe and elsewhere |
"MSL" | (modified Sainte-Lague) favors big parties slightly - used in Norway and Sweden |
"SL" | (Sainte-Lague) does not favor big or small parties - used in New Zealand, Bosnia, and Latvia |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.