vote-package: Election Vote Counting

Description Details Author(s) References Examples

Description

Counting election votes and determining election results by different methods, including the single transferable vote (ranked choice), approval, score, plurality, condorcet and two-round runoff methods. Details about the methods and package functions can be found in Raftery et al. (2021).

Details

The main function of the package is called count.votes. If no specific method is passed, it decides on the basis of the available data which method is the most appropriate. Specific methods can also be invoked explicitly. The following voting methods are available:

Output of these functions can be viewed using summary methods, or in a browser using view methods. The summary methods return a data frame which can be stored in a file, see Example below. Outputs of the stv method can be plotted in a graph. The joint and marginal distributions of ranked votes (for stv, condorcet and tworound.runoff) can be visualized in an image plot.

Functions invalid.votes, valid.votes and corrected.votes can be used to check the validity of ballots for the various methods, including corrections made within the methods. Function correct.ranking can be used to make ballot corrections to ranked data, including ballots with equal preferences.

Example datasets are included. The ims_election dataset contains anonymized ballots from a past Council election of the Institute of Mathematical Statistics (IMS) which uses the STV method. Modifications of this dataset are available (ims_approval, ims_score, ims_plurality) as examples of data required by the various methods. The food_election dataset taken from Wikipedia can be used to test the STV method. Similarly, methods for ranked voting can be applied to the dublin_west dataset which contains election ballots from the 2002 election to the Dublin West constituency in Ireland.

Author(s)

Hana Sevcikova, Bernard Silverman, Adrian Raftery

Maintainer: Hana Sevcikova

References

Raftery, A.E., Sevcikova, H. and Silverman, B.W. (2021). The vote Package: Single Transferable Vote and Other Electoral Systems in R. arXiv:2102.05801.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
data(ims_election)
res <- count.votes(ims_election, method = "stv", nseats = 5)
summary(res)

# View invalid votes
invalid.votes(res)

## Not run: 
# View results in a browser
view(res)

# Write election results into a csv file
s <- summary(res)
write.csv(s, "IMSstvresults.csv")
## End(Not run)

vote documentation built on Feb. 5, 2022, 1:08 a.m.