approval_method: Approval Method

Description Usage Arguments Value Examples

View source: R/approval_method.R

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

1
approval_method(x, min_valid = 1, n)

Arguments

x

an object of class vote.

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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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)

votesys documentation built on May 2, 2019, 1:32 p.m.