MyNixOS website logo
Description

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:

FunctionDescription
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:

FunctionDescription
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')
Metadata

Version

0.0.1

License

Unknown

Platforms (78)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows