{"id":39378282,"url":"https://github.com/alarm-redist/redist","last_synced_at":"2026-02-11T04:07:02.787Z","repository":{"id":20514486,"uuid":"23793208","full_name":"alarm-redist/redist","owner":"alarm-redist","description":"Simulation methods for legislative redistricting.","archived":false,"fork":false,"pushed_at":"2026-02-06T03:22:55.000Z","size":122994,"stargazers_count":72,"open_issues_count":7,"forks_count":27,"subscribers_count":13,"default_branch":"main","last_synced_at":"2026-02-06T06:01:04.196Z","etag":null,"topics":["geospatial","gerrymandering","r","redistricting","sampling"],"latest_commit_sha":null,"homepage":"http://alarm-redist.org/redist/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alarm-redist.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2014-09-08T14:09:15.000Z","updated_at":"2026-02-04T16:40:47.000Z","dependencies_parsed_at":"2023-02-18T00:45:19.040Z","dependency_job_id":"9f1cf745-534a-4d0a-9210-12cf0a788e00","html_url":"https://github.com/alarm-redist/redist","commit_stats":{"total_commits":1381,"total_committers":16,"mean_commits":86.3125,"dds":0.6553222302679218,"last_synced_commit":"cfe522833978896bb5796c1e7c4a86502299a57b"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/alarm-redist/redist","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alarm-redist%2Fredist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alarm-redist%2Fredist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alarm-redist%2Fredist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alarm-redist%2Fredist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alarm-redist","download_url":"https://codeload.github.com/alarm-redist/redist/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alarm-redist%2Fredist/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29326957,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-11T03:52:29.695Z","status":"ssl_error","status_checked_at":"2026-02-11T03:52:23.094Z","response_time":97,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["geospatial","gerrymandering","r","redistricting","sampling"],"created_at":"2026-01-18T02:58:04.008Z","updated_at":"2026-02-11T04:07:02.779Z","avatar_url":"https://github.com/alarm-redist.png","language":"C++","readme":"---\noutput: github_document\neditor_options: \n  markdown: \n    wrap: 80\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n# **redist**: Simulation Methods for Legislative Redistricting\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/alarm-redist/redist/actions/workflows/check-standard.yaml/badge.svg)](https://github.com/alarm-redist/redist/actions/workflows/check-standard.yaml)\n[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version-last-release/redist)](https://cran.r-project.org/package=redist)\n![CRAN downloads](http://cranlogs.r-pkg.org/badges/grand-total/redist)\n\n\u003c!-- badges: end --\u003e\n\n\u003cimg src=\"man/figures/map_photo.jpg\" class=\"pkgdown-hide\" style=\"width: 100%\"/\u003e\n\n```{r, echo = FALSE}\nknitr::opts_chunk$set(collapse = TRUE, fig.path = \"man/figures/README-\", comment = \"#\u003e\")\nset.seed(5118)\n```\n\n\u003cimg src=\"man/figures/logo.png\" class=\"pkgdown-hide\" align=\"right\" style=\"height: 128px; margin-left: 4px;\"/\u003e\n\nThis R package enables researchers to sample redistricting plans from a \npre-specified target distribution using Sequential Monte Carlo and Markov \nChain Monte Carlo algorithms. The package supports various constraints in\nthe redistricting process, such as geographic compactness and population \nparity requirements. Tools for analysis, including computation of various \nsummary statistics and plotting functionality, are also included.\n\n## Installation Instructions\n\n`redist` is available on CRAN and can be installed using:\n\n```{r eval = FALSE}\ninstall.packages(\"redist\")\n```\n\nYou can also install the most recent development version of `redist` \n(which is usually quite stable) using the `remotes` package.\n\n```{r eval=FALSE}\nif (!require(remotes)) install.packages(\"remotes\")\nremotes::install_github(\"alarm-redist/redist@dev\", dependencies=TRUE)\n```\n\n## Getting started\n\nA basic analysis has two steps. First, you define a redistricting plan using\n`redist_map`. Then you simulate plans using one of the algorithm functions:\n`redist_smc`, `redist_flip`, and `redist_mergesplit`.\n\n```{r message=FALSE}\nlibrary(redist)\nlibrary(dplyr)\n\ndata(iowa)\n\n# set a 0.1% population constraint\niowa_map = redist_map(iowa, existing_plan=cd_2010, pop_tol=0.001, total_pop = pop)\n# simulate 500 plans using the SMC algorithm\niowa_plans = redist_smc(iowa_map, nsims=500)\n```\n\nAfter generating plans, you can use `redist`'s plotting functions to study the\ngeographic and partisan characteristics of the simulated ensemble.\n\n```{r readme-plot}\nlibrary(ggplot2)\nlibrary(patchwork) # for plotting\n\nredist.plot.plans(iowa_plans, draws=c(\"cd_2010\", \"1\", \"2\", \"3\"), shp=iowa_map)\n\niowa_plans = iowa_plans %\u003e%\n    mutate(Compactness = comp_polsby(pl(), iowa_map),\n           `Population deviation` = plan_parity(iowa_map),\n           `Democratic vote` = group_frac(iowa_map, dem_08, tot_08))\n\nhist(iowa_plans, `Population deviation`) + hist(iowa_plans, Compactness) +\n    plot_layout(guides=\"collect\") +\n    plot_annotation(title=\"Simulated plan characteristics\")\nredist.plot.scatter(iowa_plans, `Population deviation`, Compactness) +\n    labs(title=\"Population deviation and compactness by plan\")\n\nplot(iowa_plans, `Democratic vote`, size=0.5, color_thresh=0.5) +\n    scale_color_manual(values=c(\"black\", \"tomato2\", \"dodgerblue\")) +\n    labs(title=\"Democratic vote share by district\")\n```\n\nA more detailed introduction to redistricting methods and the package can be\nfound in the [Get Started](https://alarm-redist.org/redist/articles/redist.html) \npage. The package [vignettes](https://alarm-redist.org/redist/articles/) \ncontain more detailed information and guides to specific workflows.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falarm-redist%2Fredist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falarm-redist%2Fredist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falarm-redist%2Fredist/lists"}