voteview_download: Download rollcalls as a rollcall object

Description Usage Arguments Details Value See Also Examples

View source: R/download.R

Description

Finds rollcalls by ID and builds a modified rollcall object from the pscl package.

Usage

1
voteview_download(ids, perrequest = 15, keeplong = T)

Arguments

ids

A character vector of vote ids.

perrequest

An integer that sets the number of votes requested at a time from the voteview database. Default is 15, and is roughly the fastest. Max is 100.

keeplong

A boolean for whether long format of the votes are kept and whether a unique data frame of legislator data is kept. Default is TRUE although this can result in a very large object being returned. See 'Details' for more information.

Details

This function returns a modified rollcall object. It inherits all of the relevant methods from pscl but has a few additional features. First, interrupted downloads can be resumed because there is a new unretrievedids vector in the rollcall object, which, if non-null, can be used in complete_download. Furthermore, the row names of the vote matrix are icpsr numbers and the column names are the rollcall id numbers that are used in the voteview database.

If keeplong = TRUE, then the rollcall object will have two additional data frames. The votes.long data frame consists of four columns, id, icpsr, vname, and vote, which are a unique id for the legislator-congress, that legislator's icpsr number, which roll call that vote belongs to, and that vote itself. Thus this is a data frame of unique id-rollcalls. Note that icpsr numbers can be constant across party changes and across chambers and congresses, while id will change with changes in chamber, congress, or party. This is important because we can then map votes to the second additional data frame, legis.long.dynamic. This data frame consists of data for unique members as identified by id, and not icpsr number. Thus this provides unique covariates by legislator-party-congress. This enables us to also store their district number for that congress as well as their name and party_code by congress, should those change over time. We retain this data frame because the default legis.data data frame is only unique to icpsr number, which can refer to the same person but in different chambers, congresses, districts, and more.

To that end, there is a column ambiguity in the legis.data data frame that denotes whether there is some ambiguity in the legislator's record. This means that perhaps across the votes that you downloaded, a legislator changed party, constituency or some other value. When that ambiguity occurs, we fill legis.data with the modal value in legis.long.dynamic and set ambiguity to 1.

Please note that some rollcalls are coded into two groups by the Issue or Peltzman codes. To deal with this, the code columns in vote.data data.frame contain concatenated strings where the groups are separated by a semi-colon and a space. For example, if a rollcall has both 'Defense Policy Resolutions' and 'Domestic Social Policy'as Peltzman codes, we return 'Defense Policy Resolutions; Domestic Social Policy' as the Peltzman code for that rollcall.

Value

A modified pscl rollcall object.

See Also

'rollcall','complete_download','voteview_search'.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Search for example roll calls
res <- voteview_search("Rhodesia")

## Download first 25
rc <- voteview_download(res$id[1:25])
summary(rc)

## Not run: 
## Lower the number of rollcalls downloaded at a time
rc <- voteview_download(res$id[1:25], perrequest = 5)

## Continue possibly broken/interrupted download
complete_rc <- complete_download(rc)

## End(Not run)

voteview/Rvoteview documentation built on Oct. 16, 2019, 4:19 a.m.