Learn R Programming

pscl (version 0.59)

dropUnanimous.matrix: drop unanimous rollcalls from a roll call matrix

Description

Drop unanimous or lop-sided rollcalls from a roll call matrix.

Usage

dropUnanimous.matrix(obj, lop = 0)

Arguments

obj
a matrix, where rows index legislators, and columns index votes
lop
numeric, non-negative integer, less than number of legislators represented in object. Roll calls with lop or fewer legislators voting in the minority are dropped.

Value

  • A matrix, with n rows (same as in the input matrix) but possibly less than the original number of columns.

Details

The roll call matrix can only contain c(0,1,NA), as is created by convertCodes. Each column of the roll call matrix is inspected, and the minimum of the number of 0 (Nay) entries and the number of 1 (Yea) entries is noted. If this number is less than or equal to lop, the column is deleted from the matrix returned by this function.

See Also

dropUnanimous, convertCodes

Examples

Run this code
data(s109)
mat <- convertCodes(s109)
class(mat)
dim(mat)
dim(dropUnanimous(mat))

## compare with operating on the rollcall object directly
## with dropUnanimous.rollcall
## produces an identical matrix
dim(dropUnanimous(s109)$votes)

Run the code above in your browser using DataLab