Redistricting in Clean Tables

Provides a suite of tools to create tables that accompany maps. The tools create clean, informative tables for electoral outcomes, compactness, and other district-level quantities. Most tools are aimed at the redistricting context, but are broadly applicable to other electoral data.


rict

rict statusbadge Lifecycle:stable R-CMD-check Codecov testcoverage

rict provides clean, formatted gt tables to accompany redistricting maps. It is designed to complement redist and redistmetrics, but works with any electoral or demographic data.

Installation

You can install the development version of rict from GitHub with:

pak::pak('christopherkenny/rict')

Overview

rict provides a family of rict_*() functions, each producing a formatted table for a specific redistricting quantity:

Function Description
rict() District-level summary from a redist_map or redist_plans
rict_demographics() Population and voting-age population by race/ethnicity
rict_elections() Democratic vote shares across electoral contests
rict_compactness() Common compactness scores (Polsby-Popper, Reock, etc.)
rict_population() Population and deviation from the ideal district size
rict_splits() Number of administrative units split by the plan
rict_contiguity() Number of contiguous pieces per district

Additional helpers embed visuals directly inside a gt table:

Function Description
gt_plot_sf() Embed district map thumbnails
gt_plot_compactness() Embed compactness geometry plots

Examples

Demographics

rict_demographics() summarizes total population and voting-age population by race/ethnicity across districts.

library(rict)
rict_demographics(map = wv, plan = wv$cd_2020)

Compactness

rict_compactness() tabulates common geometric compactness scores for each district.

rict_compactness(map = wv, plan = wv$cd_2020)

Elections

rict_elections() shows Democratic vote shares for each electoral contest, along with normal partisan averages.

rict_elections(map = wv, plan = wv$cd_2020)

Plans

For a redist_plans object, rict() formats a single draw as a table.

data(wv_plans)
rict(wv_plans, 'cd_2020')

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("rict")

0.0.1 by Christopher T. Kenny, 8 months ago


http://christophertkenny.com/rict/, https://github.com/christopherkenny/rict


Report a bug at https://github.com/christopherkenny/rict/issues


Browse source code at https://github.com/cran/rict


Authors: Christopher T. Kenny [aut, cre] (ORCID:


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports cli, dplyr, geomander, geos, ggplot2, gt, purrr, redist, redistmetrics, rlang, sf, stringr, tibble

Suggests knitr, rmarkdown, spelling, testthat


See at CRAN