plurality_method: Plurality Method to Find Absolute or Relative Majority

Description Usage Arguments Value Examples

View source: R/plurality_method.R

Description

Although with plurality method each voter is required to mention only one candidate, a ballot with more than one candidate and different scores is also valid. For a score matrix, the function will check the position j which has the lowest score (in a vote object, the lower, the better) in the ith row. Duplicated values may or may not be a problem. For instance, c(2, 3, 3) is valid, for the lowest value is 2 and it is in the 1st position. However, c(2, 2, 3) is a problem, for the 1st and 2nd positions all have the lowest value 2. If this problem exists, the winner returned by this function will be NULL.

Usage

1
plurality_method(x, allow_dup = TRUE, min_valid = 1)

Arguments

x

an object of class vote.

allow_dup

whether ballots with duplicated score values are taken into account. Default is TRUE.

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.

Value

a list object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
raw <- rbind(
    c(1, 2, 5, 3, 3), c(1, 2, 5, 3, 4), c(1, 2, 5, 3, 4), 
    c(NA, NA, NA, NA, NA), c(NA, 3, 5, 1, 2), 
    c(NA, NA, NA, 2, 3), c(NA, NA, 1, 2, 3), 
    c(NA, NA, NA, NA, 2), c(NA, NA, NA, 2, 2), 
    c(NA, NA, 1, 1, 2), c(1, 1, 5, 5, NA)
)
vote <- create_vote(raw, xtype = 1)
y <- plurality_method(vote, allow_dup = FALSE)
y <- plurality_method(vote, allow_dup=FALSE, min_valid = 3)

Example output

MATCHING NAMES AND SCORES
COUNTING NA AND DUP VALUES
MAKING CONDORCET TABLE
COLLECTING RESULT
DONE
SELECTING
COLLECTING RESULT
DONE
SELECTING
COLLECTING RESULT
DONE

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