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

Description Usage Arguments Author(s) Examples

View source: R/vote_to_rollcall.R

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

1
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.

Author(s)

Robert Myles McDonnell, Guilherme Jardim Duarte & Danilo Freire.

Examples

1
2
3
4
5
6
7
# 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)

RobertMyles/congressbr documentation built on July 18, 2020, 4:04 a.m.