Learn R Programming

voteogram (version 0.3.2)

house_carto: Produce a ProPublica- or GovTrack-style House roll call vote cartogram

Description

Produce a ProPublica- or GovTrack-style House roll call vote cartogram

Usage

house_carto(
  vote_tally,
  style = c("pp", "gt", "propublica", "govtrack"),
  pp_square = FALSE
)

Value

a ggplot2 object that you can further customize with scales, labels, etc.

Arguments

vote_tally

either a pprc object (the result of a call to roll_call()) or a data.frame of vote tallies for the house It expects 3 columns. state_abbrev : the 2-letter U.S. state abbreviation; district : either 1 or 2 to distinguish between each representative; party : R, D or ID; position : yes, no, present, none for how the representative voted.

style

either ProPublica-ish (pp or propublica) or GovTrack-ish (gt or govtrack)

pp_square

if TRUE then no "state borders" will be drawn, but distinct Representative squares. If FALSE then the cartogram will be very close to the ProPublica cartograms.

Examples

Run this code
if (FALSE) {
# what you'd normally do
rep <- roll_call("house", 115, 1, 256)
}

# using a saved object
rep <- readRDS(system.file("extdata", "rep.rds", package = "voteogram"))

house_carto(rep, pp_square = TRUE)

Run the code above in your browser using DataLab