This quorum calculation implementation is called within proporz(), biproporz() and
related functions. Generally, there's no need to call apply_quorum directly.
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 ofvotesrows.
Value
Vector or matrix with same dimension as votes. Parties that failed to reach the
specified quorum have their votes set to zero.
See also
quorum_functions for more matrix examples.
Examples
# vector
(votes = c(81, 9, 10))
#> [1] 81 9 10
apply_quorum(votes, 10)
#> [1] 81 0 10
apply_quorum(votes, .11)
#> [1] 81 0 0
# matrix
(votes_matrix = matrix(c(91, 9, 199, 1), nrow = 2))
#> [,1] [,2]
#> [1,] 91 199
#> [2,] 9 1
apply_quorum(votes_matrix, quorum_all(total = 0.1))
#> [,1] [,2]
#> [1,] 91 199
#> [2,] 0 0
apply_quorum(votes_matrix, c(FALSE, TRUE))
#> [,1] [,2]
#> [1,] 0 0
#> [2,] 9 1
