{"id":13858311,"url":"https://github.com/hrbrmstr/voteogram","last_synced_at":"2025-03-16T20:31:09.918Z","repository":{"id":56937140,"uuid":"90480981","full_name":"hrbrmstr/voteogram","owner":"hrbrmstr","description":"U.S. House and Senate Voting Cartogram Generators in R","archived":false,"fork":false,"pushed_at":"2023-03-08T12:05:10.000Z","size":2076,"stargazers_count":43,"open_issues_count":2,"forks_count":5,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-02-27T13:18:39.052Z","etag":null,"topics":["data-visualisation","data-visualization","datavisualization","r","rstats"],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hrbrmstr.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-06T17:51:43.000Z","updated_at":"2024-02-12T15:43:02.000Z","dependencies_parsed_at":"2024-06-11T19:22:59.531Z","dependency_job_id":null,"html_url":"https://github.com/hrbrmstr/voteogram","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrbrmstr%2Fvoteogram","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrbrmstr%2Fvoteogram/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrbrmstr%2Fvoteogram/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrbrmstr%2Fvoteogram/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hrbrmstr","download_url":"https://codeload.github.com/hrbrmstr/voteogram/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243830912,"owners_count":20354848,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-visualisation","data-visualization","datavisualization","r","rstats"],"created_at":"2024-08-05T03:02:03.776Z","updated_at":"2025-03-16T20:31:09.414Z","avatar_url":"https://github.com/hrbrmstr.png","language":"R","readme":"---\noutput: rmarkdown::github_document\neditor_options: \n  chunk_output_type: console\n---\n```{r include=FALSE}\nknitr::opts_chunk$set(fig.retina=2)\n```\n\n# voteogram\n\nU.S. House and Senate Voting Cartogram Generators\n\n## Description\n\n'ProPublica' \u003chttps://projects.propublica.org/represent/\u003e makes United States Congress member votes available and has developed their own unique cartogram to visually represent this data as has 'GovTrack' \u003cURL_AT_SOME_POINT\u003e . Tools are provided to retrieve voting data, prepare voting data for plotting with 'ggplot2', create vote cartograms and theme them.\n    \nRef: (these are replicated below)\n\n- \u003chttps://projects.propublica.org/represent/votes/115/senate/1/110\u003e\n- \u003chttps://projects.propublica.org/represent/votes/115/house/1/256\u003e\n- \u003chttps://www.govtrack.us/congress/votes/115-2017/h256\u003e\n\nYou 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\nelement of that list is the `data.frame` of vote results. You can pass in the _entire_\nobject to either `_carto()` function and it'll \"fortify\" it before shunting it off\nto 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). \n\n## TODO\n\n- \u003cstrike\u003eHouse cartogram generator\u003c/strike\u003e\n- \u003cstrike\u003eParam bulletproofing (param checking, et al)\u003c/strike\u003e\n- \u003cstrike\u003eAdd in ability to retrieve votes from ProPublica.\u003c/strike\u003e\n- \u003cstrike\u003eMake a `voteogram` theme\u003c/strike\u003e\n- \u003cstrike\u003eGovTrack Senate cartogram polygons\u003c/strike\u003e (this is pretty much covered in [`ggparliament`](https://github.com/leeper/ggparliament) since GT only has the seat view for the Senate)\n- \u003cstrike\u003e\"Independent\" colors for \"not voting\" \u0026 \"present\"\u003c/strike\u003e\n- \u003cstrike\u003eVignette\u003c/strike\u003e\n- `htmlwidget` version\n\n## What's In The Tin\n\nThe following functions are implemented:\n\n- `house_carto`:\tProduce a ProPublica- or GovTrack-style House roll call vote cartogram\n- `senate_carto`:\tProduce a Senate cartogram\n- `roll_call`:\tGet Voting Record for House or Senate By Number, Session \u0026 Roll Call Number\n\nHelpers: \n\n- `theme_voteogram`: voteogram ggplot2 theme\n- `print.pprc`:\tBetter default 'print' function for `roll_call()` (`pprc`) objects\n- `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\n\n## Working with `voteogram`\n\n### Installation\n\n```{r eval=FALSE}\nremotes::install_github(\"hrbrmstr/voteogram\")\n```\n\n```{r message=FALSE, warning=FALSE, error=FALSE, include=FALSE}\noptions(width=120)\n```\n\n### Basic Usage\n\n```{r message=FALSE, warning=FALSE, error=FALSE}\nlibrary(voteogram)\nlibrary(hrbrthemes)\nlibrary(ggplot2)\n\n# current verison\npackageVersion(\"voteogram\")\n```\n\n```{r cache=TRUE}\nsen \u003c- roll_call(\"senate\", 115, 1, 110)\nrep \u003c- roll_call(\"house\", 115, 1, 256)\n```\n\n```{r}\nstr(sen)\n\nsen$votes\n```\n\n```{r}\nstr(rep)\n\nfortify(rep)\n```\n\n### ProPublica\n\n```{r sen, fig.width=10, fig.height=7}\nsenate_carto(sen) +\n  labs(title=\"Senate Vote 110 - Invokes Cloture on Neil Gorsuch Nomination\") +\n  theme_ipsum_rc(plot_title_size = 24) +\n  theme_voteogram()\n```\n\n```{r rep_pp_square, fig.width=10, fig.height=7}\nhouse_carto(rep, pp_square=TRUE) +\n  labs(x=NULL, y=NULL, \n       title=\"House Vote 256 - Passes American Health Care Act,\\nRepealing Obamacare\") +\n  theme_ipsum_rc(plot_title_size = 24) +\n  theme_voteogram()\n```\n\n```{r rep_pp_orig, fig.width=10, fig.height=7}\nhouse_carto(rep, pp_square=FALSE) +\n  labs(x=NULL, y=NULL, \n       title=\"House Vote 256 - Passes American Health Care Act,\\nRepealing Obamacare\") +\n  theme_ipsum_rc(plot_title_size = 24) +\n  theme_voteogram()\n```\n\n### GovTrack\n\n```{r rep_gt, fig.width=10, fig.height=7}\nhouse_carto(rep, \"gt\") +\n  labs(x=NULL, y=NULL, \n       title=\"House Vote 256 - Passes American Health Care Act,\\nRepealing Obamacare\") +\n  theme_ipsum_rc(plot_title_size = 24) +\n  theme_voteogram()\n```\n\n### Tiny Cartograms\n\nThey can be shrunk down well (though that means annotating them in some other way):\n\n```{r sen_small, fig.width=3, fig.height=2.1}\nsenate_carto(sen) + theme_voteogram(legend=FALSE)\n```\n\n```{r rep_small, fig.width=3, fig.height=2.1}\nhouse_carto(rep) + theme_voteogram(legend=FALSE)\n```\n\n```{r rep_small_1, fig.width=3, fig.height=2.1}\nhouse_carto(rep, pp_square=TRUE) + theme_voteogram(legend=FALSE)\n```\n\n### Test Results\n\n```{r message=FALSE, warning=FALSE, error=FALSE}\nlibrary(voteogram)\nlibrary(testthat)\n\ndate()\n\ntest_dir(\"tests/\")\n```\n\n## Code of Conduct\n\nPlease 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.","funding_links":[],"categories":["R"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhrbrmstr%2Fvoteogram","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhrbrmstr%2Fvoteogram","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhrbrmstr%2Fvoteogram/lists"}