View source: R/social_choice.R
social_choice | R Documentation |
Compute election outcomes on ranked ballots with a variety of social choice functions.
social_choice(
ballots,
sc_function = c("plurality", "irv", "stv"),
n_winners = 1,
...
)
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. |
The output depends on the chosen 'sc_function':
A character vector with the candidate(s) who received the most votes.
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).
Not yet implemented.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.