irv_method: Instant-Runoff Voting Method

Description Usage Arguments Value References Examples

View source: R/irv_method.R

Description

Instant-runoff voting (IRV) method is also called alternative voting, transferable voting, ranked-choice voting, single-seat ranked-choice voting, or preferential voting. In the 1st round, the candidate with absolute majority (that is, with more than 50 percent) wins. If no absolute winner exists, the one who gets the least votes is deleted, all other candidates enter into the 2nd round. Again, if no absolute winner exists, let the one with the least votes go and start the 3rd round... Finally, an absolute winner will appear. Ties are solved with different methods in reality; however, this function applies the following rules: (a) if more than one candidate gets the least votes, let all of them go; (b) if all the candidates get the same number of votes in a certain round, then all of them are winners. Note: the function accepts object of class vote and the method can only be used when x$approval_able is TRUE, that is, there is no duplicated values in the score matrix; otherwise, the winner will be NULL.

Usage

1
irv_method(x, min_valid = 1)

Arguments

x

an object of class vote.

min_valid

default is 1. If the number of valid entries of a ballot is less than this value, the ballot will not be used.

Value

a list object.

References

Examples

1
2
3
4
5
6
7
raw <- c(
   rep(c('m', 'n', 'c', 'k'), 42), rep(c('n', 'c', 'k', 'm'), 26), 
   rep(c('c', 'k', 'n', 'm'), 15), rep(c('k', 'c', 'n', 'm'), 17)
) 
raw <- matrix(raw, ncol = 4, byrow = TRUE)
vote <- create_vote(raw, xtype = 2, candidate = c('m', 'n', 'k', 'c'))
y <- irv_method(vote) # winner is k

Example output

MATCHING NAMES AND SCORES
COUNTING NA AND DUP VALUES
MAKING CONDORCET TABLE
COLLECTING RESULT
DONE
SELECTING
------ROUND: 1
------ROUND: 2
------ROUND: 3
COLLECTING RESULT
DONE

votesys documentation built on May 2, 2019, 1:32 p.m.