count.votes: Count Votes

Description Usage Arguments Value Author(s) See Also Examples

Description

Count votes using one of four methods. View valid and invalid ballots.

Usage

1
2
3
4
5
count.votes(votes, method = c("auto", "plurality", "approval", "stv", "score"), 
    fsep = "\t", ...)
	
invalid.votes(object)
valid.votes(object)

Arguments

votes

Matrix or data frame containing the votes. Rows correspond to the votes, columns correspond to the candidates. If it is a character string it is interpreted as a tab-separated file name from which the votes are to be read.

method

Voting method to use. If “auto”, the input data is passed through a checker for each of the methods and the one with the largest number of valid votes is used. In case of the same number of valid votes, it goes by their ordering in the function definition.

fsep

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

...

Additional arguments passed to the underlying functions, e.g. mcan, max.score etc.

object

Object returned by one of the functions plurality, approval, stv, score.

Value

Depending which method is used, count.votes returns an object of class vote.plurality, vote.approval, vote.stv, or vote.score.

Functions valid.votes and invalid.votes return a subset of the input data with valid records and invalid records, respectively.

Author(s)

Hana Sevcikova, Bernard Silverman

See Also

stv, approval, score

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Example using the IMS Council dataset modified for score voting
data(ims_score)
# should recognize that it is a dataset with score voting data
count.votes(ims_score, max.score = 9, larger.wins = FALSE)

# All records with score larger than 8 are excluded 
res <- count.votes(ims_score, method = "score", max.score = 8)
head(invalid.votes(res))

summary(res)

vote documentation built on May 2, 2019, 1:09 p.m.