melt_rollcall: Melt rollcall object to long rollcall data frame

Description Usage Arguments Details Value See Also Examples

View source: R/rollcallUtilities.R

Description

This function takes a rollcall object and melts it into a long format, merging attributes of the rollcalls and legislators. This can be used for legislator-rollcall analyses.

Usage

1
2
melt_rollcall(rc, keepvote = rownames(rc$vote.data), legiscols = NULL,
  votecols = NULL, dropNotInLegis = TRUE)

Arguments

rc

A rollcall object.

keepvote

A character vector of vote names to keep. Defaults to all.

legiscols

A character vector of column names from legis.data to include. Defaults to all columns.

votecols

A character vector of column names from vote.data to include. Defaults to all columns.

dropNotInLegis

Boolean to drop votes that were "notInLegis". Defaults to TRUE.

Details

This function works for any rollcall object that meets the following two criteria. The vote.names, or the row names of the vote.data matrix within the rollcall object, must match the column names of the votes matrix. Similarly, the legis.names, or the row names of the legis.data matrix within the rollcall object, must match the row names of the votes matrix.

This will work for all rollcall objects downloaded from the voteview database. If legis.long.dynamic and votes.long are included, meaning keeplong == TRUE, then the melted data frame will be unique by internal id and roll call. Otherwise the melted data frame will be unique by icpsr and roll call.

Value

A data.frame with the following columns:

See Also

'rollcall'.

Examples

1
2
3
4
5
6
7
8
## Search for example roll calls
res <- voteview_search("Rhodesia")

## Download some ids
rc <- voteview_download(res$id[1:10])

## Create long rollcall object, wihtout long description fields
rclong <- melt_rollcall(rc, votecols = c("chamber", "congress"))

JeffreyBLewis/Rvoteview documentation built on Oct. 15, 2019, 10:18 p.m.