approval {vote}R Documentation

Approval and Plurality Vote Count

Description

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).

Usage

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, ...)


Arguments

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 (NA) are interpreted as zeros.

nseats

Number of candidates to be elected.

fsep

If votes is a file name, this argument gives the column separator in the file.

quiet

If TRUE no output is printed.

...

Not used.

object

Object of class vote.approval or vote.plurality.

Value

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.

Author(s)

Hana Sevcikova, Adrian Raftery

References

https://en.wikipedia.org/wiki/Approval_voting

https://en.wikipedia.org/wiki/Plurality_voting_method

See Also

count.votes

Examples

# 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)

[Package vote version 2.4-3 Index]