Compute election outcomes on ranked ballots with a variety of social choice functions.
Usage
social_choice(
ballots,
sc_function = c("plurality", "irv", "stv"),
n_winners = 1,
...
)
Arguments
- ballots
A `prefio::preferences` object containing the ballots cast in the election.
- sc_function
One of "plurality", "irv" or "stv", corresponding to the social choice function you wish to evaluate.
- n_winners
Refers to the number of seats available when `sc_function` is "stv".
- ...
Unused.
Value
The output depends on the chosen `sc_function`:
- "plurality"
A character vector with the candidate(s) who received the most votes.
- "irv"
A named `list` with two objects. First, "elimination_order" is a vector with each eliminated candidate in the order of elimination. Second, "winners" is the vector containing the winning candidate(s).
- "stv"
Not yet implemented.