Learn R Programming

congressbr (version 0.2.2)

vote_to_rollcall: Create rollcall or matrix format data structures from voting records

Description

Returns votes from the Senate or Chamber of Deputies in a format that can be easily used with other R packages (wnominate, pscl, MCMCpack) or with other modelling languages such as JAGS.

Usage

vote_to_rollcall(votes = NULL, legislators = NULL, bills = NULL, ideal = TRUE)

Arguments

votes

integer. The recorded nominal votes. Must be in the format 1, 0, where 1 indicates a 'Yes' vote, 0 a 'No' vote. Missing values must be NA. All of the votes, legislators and bills parameters must be vectors.

legislators

This may be a vector of legislator names or id numbers.

bills

A vector of bill numbers or ids.

ideal

If TRUE, the default, returns a rollcall object for use with pscl and/or wnominate. If FALSE, returns a matrix suitable for use with MCMCpack or the JAGS modelling language.

Examples

Run this code
# NOT RUN {
# get votes:
data(sen_nominal_votes)
votes <- sen_nominal_votes %>%
    dplyr::filter(vote_date >= "2005-03-01", vote_date <= "2007-12-15")
rc <- vote_to_rollcall(votes$senator_vote,
                       legislators = votes$senator_name,
                       bills = votes$bill_id)
# }

Run the code above in your browser using DataLab