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

Description Usage Arguments Examples

View source: R/voteToRollcall.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
voteToRollcall(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

1
2
3
4
5
6
7
# get votes:
# data(cam_nominal_votes)
# votes <- cam_nominal_votes %>%
#    dplyr::filter(vote_date >= "2005-03-01", vote_date <= "2007-12-15")
# rc <- voteToRollcall(votes$senator_vote,
#                       legislators = votes$senator_name,
#                       bills = votes$bill_id)

danielmarcelino/CamaraBR documentation built on Nov. 6, 2021, 9:45 a.m.