Title: | United States House and Senate Voting Cartogram Generators |
---|---|
Description: | 'ProPublica' <https://projects.propublica.org/represent/> makes United States Congress member votes available and has developed their own unique cartogram to visually represent this data. Tools are provided to retrieve voting data, prepare voting data for plotting with 'ggplot2', create vote cartograms and theme them. |
Authors: | Bob Rudis [aut, cre] , ProPublica [cph] (Cartogram SVGs used to make the plot data.frames), GovTrack [cph] (Cartogram SVG used to make the plot data.frame) |
Maintainer: | Bob Rudis <[email protected]> |
License: | AGPL |
Version: | 0.3.2 |
Built: | 2025-01-28 03:40:45 UTC |
Source: | https://github.com/hrbrmstr/voteogram |
roll_call()
(pprc
) objectFortify a roll_call()
(pprc
) object
## S3 method for class 'pprc' fortify(model, data, ...)
## S3 method for class 'pprc' fortify(model, data, ...)
model |
a |
data |
unused |
... |
unused |
Produce a ProPublica- or GovTrack-style House roll call vote cartogram
house_carto( vote_tally, style = c("pp", "gt", "propublica", "govtrack"), pp_square = FALSE )
house_carto( vote_tally, style = c("pp", "gt", "propublica", "govtrack"), pp_square = FALSE )
vote_tally |
either a |
style |
either ProPublica-ish ( |
pp_square |
if |
a ggplot2
object that you can further customize with scales, labels, etc.
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.
## 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)
## 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)
print
function for roll_call()
(pprc
) objectsBetter default print
function for roll_call()
(pprc
) objects
## S3 method for class 'pprc' print(x, ...)
## S3 method for class 'pprc' print(x, ...)
x |
a |
... |
ignored |
Get Voting Record for House or Senate By Number, Session & Roll Call Number
roll_call(critter = c("house", "senate"), number, session = c(1L, 2L), rcall)
roll_call(critter = c("house", "senate"), number, session = c(1L, 2L), rcall)
critter |
one of 'house' or 'senate' |
number |
valid congress number. ProPublica seems to have data going back to the 101st Congress, so valid values are '101'-present Congress number ('115' as of the creation date of the package). |
session |
a valid session numbner (i.e. '1' or '2' and valid for current year) |
rcall |
roll call vote number |
a 'list', one component of which is a 'votes' 'data.frame'
Try to cache this data if at all possible. ProPublica is a non-profit organization and this data comes from their Amazon S3 buckets. Every access in a given month ticks down the "free" counter.
## Not run: # these make API calls so they aren't run in the examples rep <- roll_call("house", 115, 1, 256) sen <- roll_call("senate", 115, 1, 110) ## End(Not run)
## Not run: # these make API calls so they aren't run in the examples rep <- roll_call("house", 115, 1, 256) sen <- roll_call("senate", 115, 1, 110) ## End(Not run)
Produce a Senate cartogram
senate_carto(vote_tally)
senate_carto(vote_tally)
vote_tally |
either a |
a ggplot2
object that you can further customize with scales, labels, etc.
No "themeing" is applied to the returned ggplot2 object. You can use theme_voteogram()
if you need a base theme.
## Not run: # what you'd normally do sen <- roll_call("senate", 115, 1, 110) ## End(Not run) # Using a saved object sen <- readRDS(system.file("extdata", "sen.rds", package = "voteogram")) senate_carto(sen)
## Not run: # what you'd normally do sen <- roll_call("senate", 115, 1, 110) ## End(Not run) # Using a saved object sen <- readRDS(system.file("extdata", "sen.rds", package = "voteogram")) senate_carto(sen)
Provides a very basic theme with no background, grid, axis text or axis ticks and an easy way to turn the legend on or off.
theme_voteogram(legend = TRUE)
theme_voteogram(legend = TRUE)
legend |
if 'FALSE' no legend is shown |
## Not run: # what you'd normally do sen <- roll_call("senate", 115, 1, 110) ## End(Not run) # using a saved object sen <- readRDS(system.file("extdata", "sen.rds", package="voteogram")) senate_carto(sen) + theme_voteogram()
## Not run: # what you'd normally do sen <- roll_call("senate", 115, 1, 110) ## End(Not run) # using a saved object sen <- readRDS(system.file("extdata", "sen.rds", package="voteogram")) senate_carto(sen) + theme_voteogram()
ProPublica' <https://projects.propublica.org/represent/> makes United States Congress member votes available and has developed their own unique cartogram to visually represent this data. Tools are provided to retrieve voting data, prepare voting data for plotting with 'ggplot2', create vote cartograms and theme them.
Bob Rudis ([email protected])
Manual color scales fill and color scale values (in the event you need to use them) outisde the main plotting functions.
vote_carto_fill vote_carto_color
vote_carto_fill vote_carto_color
An object of class character
of length 13.
An object of class character
of length 13.
The following functions are imported and then re-exported from the voteogram package to enable use of the magrittr pipe operator with no additional library calls