prcalc: Proportional Representation Calculator

prcalcR Documentation

Proportional Representation Calculator

Description

Proportional Representation Calculator

Usage

prcalc(x, m, method, extra = NULL, threshold = 0)

Arguments

x

a data.frame or tibble object.

m

a numeric vector of district magnitude.

method

a character string giving a method for computing seat allocation. See "Allocation methods" section.

extra

a numeric vector of length m. If method is "custom divisor" ("cd") or "custom quota" ("cq"), this parameter is mandatory. See "About custom methods" section.

threshold

a threshold. It must be equal or larger than 0 (0%) and smaller than 0.1 (10%). a default is 0.

Value

a prcalc object

Allocation methods

aaa

About custom methods

Custom methods ("custom divisor" and "custom quota") require extra parameter. In the case of "custom divisor" ("cd"), a numeric vector of the same length as the magnitude (m) must be specified. If the magnitude (m) is a vector of length 2 or longer, the extra must have a length equal to max(m). For example, if m = c(5, 7, 4), then the length of the extra must be 7.

In the case of "custom quota", extra must be a vector of the same length as m. For example, if m = c(5, 7, 4), extra must also be a numeric vector of length 3. If length of extra is 1, the same quota is applied to all blocks.

See Also

print.prcalc, summary.prcalc, plot.prcalc

Examples

data(jp_upper_2019)
data(jp_lower_2021)
prcalc(jp_upper_2019, m = 50, method = "dt")

japan_2021 <- prcalc(jp_lower_2021,
                     m = c(8, 14, 20, 21, 17, 11, 21, 30, 11, 6, 21),
                     method = "hare")
japan_2021

JaehyunSong/PRcalc documentation built on April 17, 2024, 1:23 p.m.