Description Usage Arguments Details Value See Also Examples
View source: R/rollcallUtilities.R
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.
1 2 | melt_rollcall(rc, keepvote = rownames(rc$vote.data), legiscols = NULL,
votecols = NULL, dropNotInLegis = TRUE)
|
rc |
A rollcall object. |
keepvote |
A character vector of vote names to keep. Defaults to all. |
legiscols |
A character vector of column names from |
votecols |
A character vector of column names from |
dropNotInLegis |
Boolean to drop votes that were "notInLegis". Defaults to TRUE. |
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.
A data.frame with the following columns:
id Legislator ids from rollcall object
vname Vote names from rollcall object
vote Numeric vote for legislator-rollcall pair
votecols All columns selected from vote.data
legiscols All columns selected from legis.data
'rollcall'.
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"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.