voteogram
U.S. House and Senate Voting Cartogram Generators in R
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.0%) to scientific vocabulary
Keywords
data-visualisation
data-visualization
datavisualization
r
rstats
Last synced: 6 months ago
·
JSON representation
Repository
U.S. House and Senate Voting Cartogram Generators in R
Basic Info
- Host: GitHub
- Owner: hrbrmstr
- Language: R
- Default Branch: master
- Size: 1.98 MB
Statistics
- Stars: 42
- Watchers: 5
- Forks: 5
- Open Issues: 2
- Releases: 1
Topics
data-visualisation
data-visualization
datavisualization
r
rstats
Created almost 9 years ago
· Last pushed almost 3 years ago
Metadata Files
Readme
README.Rmd
---
output: rmarkdown::github_document
editor_options:
chunk_output_type: console
---
```{r include=FALSE}
knitr::opts_chunk$set(fig.retina=2)
```
# voteogram
U.S. House and Senate Voting Cartogram Generators
## Description
'ProPublica' makes United States Congress member votes available and has developed their own unique cartogram to visually represent this data as has 'GovTrack' . Tools are provided to retrieve voting data, prepare voting data for plotting with 'ggplot2', create vote cartograms and theme them.
Ref: (these are replicated below)
-
-
-
You can grab the results of a roll call vote (House or Senate) with `roll_call()`. It returns a `list` with a ton of information that you can use outside this package. One
element of that list is the `data.frame` of vote results. You can pass in the _entire_
object to either `_carto()` function and it'll "fortify" it before shunting it off
to ggplot2. Try to cache this data (I do, below, in R markdown chunk) as you're ticking credits off of ProPublica's monthly free S3 allotment each call. Consider donating to them if you're too lazy to cache the data).
## TODO
- House cartogram generator
- Param bulletproofing (param checking, et al)
- Add in ability to retrieve votes from ProPublica.
- Make a `voteogram` theme
- GovTrack Senate cartogram polygons (this is pretty much covered in [`ggparliament`](https://github.com/leeper/ggparliament) since GT only has the seat view for the Senate)
- "Independent" colors for "not voting" & "present"
- Vignette
- `htmlwidget` version
## What's In The Tin
The following functions are implemented:
- `house_carto`: Produce a ProPublica- or GovTrack-style House roll call vote cartogram
- `senate_carto`: Produce a Senate cartogram
- `roll_call`: Get Voting Record for House or Senate By Number, Session & Roll Call Number
Helpers:
- `theme_voteogram`: voteogram ggplot2 theme
- `print.pprc`: Better default 'print' function for `roll_call()` (`pprc`) objects
- `fortify.pprc` : In case you want to use the voting data frame from a `roll_call()` (`pprc`) object in your own plots and forget to just `$votes` it out. #helping
## Working with `voteogram`
### Installation
```{r eval=FALSE}
remotes::install_github("hrbrmstr/voteogram")
```
```{r message=FALSE, warning=FALSE, error=FALSE, include=FALSE}
options(width=120)
```
### Basic Usage
```{r message=FALSE, warning=FALSE, error=FALSE}
library(voteogram)
library(hrbrthemes)
library(ggplot2)
# current verison
packageVersion("voteogram")
```
```{r cache=TRUE}
sen <- roll_call("senate", 115, 1, 110)
rep <- roll_call("house", 115, 1, 256)
```
```{r}
str(sen)
sen$votes
```
```{r}
str(rep)
fortify(rep)
```
### ProPublica
```{r sen, fig.width=10, fig.height=7}
senate_carto(sen) +
labs(title="Senate Vote 110 - Invokes Cloture on Neil Gorsuch Nomination") +
theme_ipsum_rc(plot_title_size = 24) +
theme_voteogram()
```
```{r rep_pp_square, fig.width=10, fig.height=7}
house_carto(rep, pp_square=TRUE) +
labs(x=NULL, y=NULL,
title="House Vote 256 - Passes American Health Care Act,\nRepealing Obamacare") +
theme_ipsum_rc(plot_title_size = 24) +
theme_voteogram()
```
```{r rep_pp_orig, fig.width=10, fig.height=7}
house_carto(rep, pp_square=FALSE) +
labs(x=NULL, y=NULL,
title="House Vote 256 - Passes American Health Care Act,\nRepealing Obamacare") +
theme_ipsum_rc(plot_title_size = 24) +
theme_voteogram()
```
### GovTrack
```{r rep_gt, fig.width=10, fig.height=7}
house_carto(rep, "gt") +
labs(x=NULL, y=NULL,
title="House Vote 256 - Passes American Health Care Act,\nRepealing Obamacare") +
theme_ipsum_rc(plot_title_size = 24) +
theme_voteogram()
```
### Tiny Cartograms
They can be shrunk down well (though that means annotating them in some other way):
```{r sen_small, fig.width=3, fig.height=2.1}
senate_carto(sen) + theme_voteogram(legend=FALSE)
```
```{r rep_small, fig.width=3, fig.height=2.1}
house_carto(rep) + theme_voteogram(legend=FALSE)
```
```{r rep_small_1, fig.width=3, fig.height=2.1}
house_carto(rep, pp_square=TRUE) + theme_voteogram(legend=FALSE)
```
### Test Results
```{r message=FALSE, warning=FALSE, error=FALSE}
library(voteogram)
library(testthat)
date()
test_dir("tests/")
```
## Code of Conduct
Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). By participating in this project you agree to abide by its terms.
Owner
- Name: boB Rudis
- Login: hrbrmstr
- Kind: user
- Location: Maine
- Company: GreyNoise Intelligence
- Website: https://rud.is/
- Repositories: 716
- Profile: https://github.com/hrbrmstr
🇺🇦 Pampa • Don't look at me…I do what he does—just slower. #rstats avuncular•👨🍳•✝️• 💤• Varaforseti í Gögn Vísindi @ @GreyNoise-Intelligence +CMU Lecturer
GitHub Events
Total
Last Year
Committers
Last synced: over 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| boB Rudis | b****b@r****s | 21 |
| Christophe Dervieux | c****x@g****m | 1 |
Committer Domains (Top 20 + Academic)
rud.is: 1
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 2
- Total pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: about 2 hours
- Total issue authors: 2
- Total pull request authors: 1
- Average comments per issue: 0.0
- Average comments per pull request: 2.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- dpseidel (1)
- sbgraves237 (1)
Pull Request Authors
- cderv (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cran 200 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 3
- Total maintainers: 1
cran.r-project.org: voteogram
United States House and Senate Voting Cartogram Generators
- Homepage: https://github.com/hrbrmstr/voteogram
- Documentation: http://cran.r-project.org/web/packages/voteogram/voteogram.pdf
- License: AGPL
-
Latest release: 0.3.2
published almost 3 years ago
Rankings
Forks count: 7.7%
Stargazers count: 7.8%
Average: 23.2%
Dependent packages count: 29.8%
Downloads: 35.4%
Dependent repos count: 35.5%
Maintainers (1)
Last synced:
6 months ago
Dependencies
DESCRIPTION
cran
- R >= 3.2.0 depends
- dplyr * imports
- ggplot2 * imports
- jsonlite * imports
- scales * imports
- utils * imports
- covr * suggests
- knitr * suggests
- rmarkdown * suggests
- testthat * suggests