approval | R Documentation |
Count votes using the approval and plurality methods. Each voter can select candidates using 1 for a selection and 0 otherwise. In the approval method, any number of candidates can be selected by a voter, while in the plurality method only one candidate can be chosen by a voter. Thus, plurality voting is a special case of approval voting. The winner(s) in either method is/are the most-approved candidate(s).
approval(votes, nseats = 1, fsep = "\t", quiet = FALSE, ...)
## S3 method for class 'vote.approval'
summary(object, ...)
## S3 method for class 'vote.approval'
view(object, ...)
plurality(votes, nseats = 1, fsep = "\t", quiet = FALSE, ...)
## S3 method for class 'vote.plurality'
summary(object, ...)
## S3 method for class 'vote.plurality'
view(object, ...)
votes |
Matrix or data frame of zeros and ones containing the votes. Rows correspond to the votes, columns correspond to the candidates. If it is a character string it is interpreted as a file name from which the votes are to be read. Missing values ( |
nseats |
Number of candidates to be elected. |
fsep |
If |
quiet |
If |
... |
Not used. |
object |
Object of class |
Functions approval
and plurality
return an object of class vote.approval
and vote.plurality
, respectively, both of which are lists with the following objects:
elected |
Vector of names of the elected candidates in the order in which they were elected. |
totals |
Vector of total votes in the same order as candidates (columns) in the input data. |
data |
Input data with invalid votes removed. |
invalid.votes |
Matrix of invalid votes that were removed from the original dataset. |
Hana Sevcikova, Adrian Raftery
https://en.wikipedia.org/wiki/Approval_voting
https://en.wikipedia.org/wiki/Plurality_voting_method
count.votes
# Example using the IMS Council dataset modified for approval voting
data(ims_approval)
approval(ims_approval)
# Example using the IMS Council dataset modified for plurality voting
data(ims_plurality)
pl.ims <- plurality(ims_plurality)
invalid.votes(pl.ims)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.