approval_method {votesys} | R Documentation |
Approval Method
Description
In approval method, each voter is required to mention
one or more candidates, and the winner is the one
who gets the top frequency. For this function, a ballot
with candidates more than required and
different scores is also valid. For a score matrix, the function will
check the positions j, k...which have the
lowest scores (in a vote
object,
the lower, the better) in the ith row. However, the function will
first check the approval_able
element of
the vote
object. If it is FALSE, the winner will be NULL.
Usage
approval_method(x, min_valid = 1, n)
Arguments
x |
an object of class |
min_valid |
default is 1. If the number of valid entries of a ballot is less than this value, the ballot will not be used. |
n |
the number of candidates written down by a voter should not larger than this value. |
Value
a list object.
(1)
call
the function call.(2)
method
the counting method.(3)
candidate
candidate names.(4)
candidate_num
number of candidate.(5)
ballot_num
number of ballots in x.(6)
valid_ballot_num
number of ballots that are used to compute the result.(7)
winner
the winners, may be one, more than one or NULL.(8)
n
equal to the argumentn
.(9)
other_info
frequencies of candidates mentioned by voters.
Examples
raw <- matrix(NA, nrow = 22, ncol = 5)
for (i in 1: 20){
set.seed(i)
raw[i, ] <- sample(c(1: 5, NA, NA, NA), 5)
}
raw[21, ] <- c(4, 5, 3, 1, 2)
raw[22, ] <- c(3, 5, 1, 2, 4)
vote <- create_vote(raw, xtype = 1)
y <- approval_method(vote, n = 3)
y <- approval_method(vote, n = 3, min_valid = 5)
y <- approval_method(vote, n = 4, min_valid = 3)