Defines functions GTT

Documented in GTT

GTT <- function (x) {
# calculate two-partiness (Gains & Taagepera T)
# input: vector of vote share, ordered by party strength
# input validation: are percentages provided?
s <- sum(x)
if (s>1) {x <- x/100
warning("Sum of the vector provided is greater than 1: Values were divided by 100, assuming percentages were provided. Check your input.")
# two-partiness:
P1 <- x[1]
P2 <- x[2]
P3 <- x[3]

Try the polrep package in your browser

Any scripts or data that you put into this service are public.

polrep documentation built on Oct. 9, 2017, 3:01 p.m.