Learn R Programming

proporz (version 1.5.1)

apply_quorum: Apply quorum to votes vector or matrix

Description

This quorum calculation implementation is called within proporz(), biproporz() and related functions. Generally, there's no need to call apply_quorum directly.

Usage

apply_quorum(votes, quorum)

Value

Vector or matrix with same dimension as votes. Parties that failed to reach the specified quorum have their votes set to zero.

Arguments

votes

votes vector or votes matrix

quorum

Depending on votes:

  • For a vector: Vote threshold a party must reach. Used as fraction of total votes if less than 1 otherwise as number of votes.

  • For a matrix: List of quorum functions (created with quorum_functions) or a logical vector with the same length as the number of votes rows.

See Also

quorum_functions for more matrix examples.

Examples

Run this code
# vector
(votes = c(81, 9, 10))

apply_quorum(votes, 10)

apply_quorum(votes, .11)

# matrix
(votes_matrix = matrix(c(91, 9, 199, 1), nrow = 2))

apply_quorum(votes_matrix, quorum_all(total = 0.1))

apply_quorum(votes_matrix, c(FALSE, TRUE))

Run the code above in your browser using DataLab