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

View source: R/gghouse.r

house_cartoR Documentation

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
)

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.

Value

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

Note

No "themeing" is applied to the returned ggplot2 object. You can use theme_voteogram() if you need a base theme. Also, GovTrack-style cartograms will have coord_equal() applied by default.

Examples

## Not run: 
# what you'd normally do
rep <- roll_call("house", 115, 1, 256)

## End(Not run)

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

house_carto(rep, pp_square = TRUE)

voteogram documentation built on March 31, 2023, 10:51 p.m.