Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

vectorRepresentation

convert roll call matrix to series of vectors


Description

Extract the information in a roll call matrix as a series of vectors with voting decision, a unique identifier for the legislator and a unique identifier for the roll call.

Usage

vectorRepresentation(object, dropList = list(codes = c("missing", "notInLegis")))

Arguments

object

an object of class rollcall

dropList

a dropList; see dropRollCall

Details

It is often the case that roll call matrices are sparse, say, when the roll call matrix has an “overlapping generations” structure; e.g., consider forming data by pooling across a long temporal sequence of legislatures such that relatively few of the legislators in the data set actually vote on any given roll call. In such a case, representing the data as a roll call matrix is not particularly helpful nor efficient, either for data summaries or modeling.

Value

A matrix with z rows, where z is the number of non-missing entries in object$votes, with ‘missingness’ defined by the codes component of the dropList. The matrix has 3 columns:

vote

the voting decision, either a 1 if the corresponding element of the roll call matrix object$votes is in the yea component of object$codes, or a 0 if the corresponding element of the roll call matrix is in the nay component of object$codes. Non-missing entries of the roll call matrix are not stored.

i

the row of the roll call matrix object$votes that supplied the voting decision; i.e., a unique identifier for the legislator generating this vote

j

the column of the roll call matrix object$votes that supplied the vote; i.e., a unique identifier for the vote.

Author(s)

See Also

Examples

data(s109)
y <- vectorRepresentation(s109)
apply(y,2,table,exclude=NULL)

pscl

Political Science Computational Laboratory

v1.5.5
GPL-2
Authors
Simon Jackman, with contributions from Alex Tahk, Achim Zeileis, Christina Maimone, Jim Fearon and Zoe Meers
Initial release
2020-02-25

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.