allocation | R Documentation |
Largest Remainder Method
allocation(x, m, method, extra = NULL)
x |
a data.frame or tibble with two columns. The first and second column represents names of parties and numbers of votes, respectively. |
m |
a numeric value of district magnitude. |
method |
a character string giving a method for computing seat allocation. See "Allocation methods" section. |
extra |
a numeric vector of length |
A tibble object with two columns.
Highest average method
"d'hondt"
("dt"
) or "jefferson"
: D'hondt / Jefferson method
"adams"
or "cambridge"
: Adams / Cambridge method
"sainte-lague"
("sl"
) or "webster"
: Sainte-Laguë / Webster method
"modified sainte-lague"
("msl"
): Modified Sainte-Laguë method
"danish"
: Danish method
"imperiali"
: Imperiali method
"hungtington-hill"
("hh"
): Huntington-Hill method
"dean"
: Dean method
"ad"
: alpha-divergence. extra
is mandatory.
"custom divisor"
("cd"
): Custom divisor. extra
is mandatory.
Largest reminder method
"hare-niemeyer"
("hn"
or "hare"
): Hare-Niemeyer quota
"droop"
: Droop quota
"hagenbach-bischoff"
("hb"
): Hagenbach-Bischoff quota
"imperiali quota"
("iq"
): Imperiali quota
"custom quota"
("cq"
): Custom quota. extra
is mandatory.
sample_data <- data.frame(Party = c("Party A", "Party B", "Party C", "Party D"),
Votes = c(53000, 25000, 16600, 5400))
sample_data
# Magnitude = 10, Hare-Niemeyer quota
allocation(x = sample_data, m = 10, method = "hare")
# Magnitude = 10, D'hondt method
allocation(x = sample_data, m = 10, method = "dt")
# Custom divisor: 1.4, 3, 5, 7, ... (identical to Modified Sainte-Laguë method)
allocation(x = sample_data, m = 10, method = "custom divisor",
extra = c(1.4, seq(3, 19, by = 2)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.