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

convertCodes

convert entries in a rollcall matrix to binary form


Description

Convert roll call matrix to binary form using encoding information.

Usage

convertCodes(object, codes = object$codes)

Arguments

object

rollcall object

codes

list, mapping entries in the votes component of rollcall object to 0 (‘Nay’), 1 (‘Yea’) and NA (missing, abstentions, etc). Defaults to the codes component of the rollcall object.

Details

See rollcall for details on the form of the codes list.

Value

a matrix with dimensions equal to the dimensions of the votes component of the rollcall object.

Note

Any entries in the votes matrix that can not be mapped into c(0,1,NA) using the information in codes are mapped to NA, with an informative message sent to the console.

Author(s)

See Also

Examples

data(s109)
  mat <- convertCodes(s109)
  table(mat,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.