irv: Instant runoff voting.

Description Usage Arguments Value Examples

Description

Instant runoff voting.

Usage

1
irv(votes, tiebreak = "all")

Arguments

votes

A list of order-of-preference vote vectors, or a list of ballot objects.

tiebreak

String informing tiebreak behavior.

"all"

All tied losers will be dropped

"random"

Tied losers will be dropped randomly

"nested"

Tied losers will be broken by running a nested IRV only considering votes for the losers.

Value

An IRV object, containing:

winner:

the winning entry or entries in the case of a tie

nrounds:

the number of rounds required to find a winner

rem_rounds:

list of which entries were in contention at each round

fps_rounds:

table of first preference votes through each round

eliminations:

list of eliminated entries at each round

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
votes <- list(
  dex = c("Ice Skating", "Unihoc", "Food"),
  dean = c("Ice Skating", "Unihoc", "Food"),
  paul = c("Whiskey Tasting", "Established"),
  james = c("Ice Skating", "Unihoc", "Food")
)

irv(votes)

map <- c("e", "f", "i", "u", "w")
votes <- list(
  ballot(0, 3, 1, 2, 0, map = map),
  ballot(0, 3, 1, 2, 0, map = map),
  ballot(2, 0, 0, 0, 1, map = map),
  ballot(0, 3, 1, 2, 0, map = map)
)
irv(votes)

DexGroves/avr documentation built on May 6, 2019, 2:12 p.m.