redistio provides a point-and-click districting interface powered by
Shiny and
mapgl. For regular sf objects, it
can be used to draw districts and export assignment files. For
redist_map objects, algorithmic assistance is enabled for map drawing.
You can install the development version of redistio from
GitHub with:
pak::pak('christopherkenny/redistio')Or from R-universe with:
install.packages('redistio', repos = c('https://christopherkenny.r-universe.dev', 'https://cloud.r-project.org'))The most basic application of redistio starts with an sf tibble and
a column of district assignments.
library(redistio)
draw(dc, dc$ward)The editor can be configured primarily through redistio_options().
Some configurable options:
theme: the bslib theme to usepanels: which panels to include. Allows for removing panels likeelections, if drawing districts in a party-blind mannerpalette_party: the colors to use for partisan mapspalette_pop: the colors to use for population mapspalette_pct: the colors to use for percentage maps. Diverging palettes are recommended.map_tiles: the base map style function to use from mapgluse_alogrithms: whether to enable algorithmic assistance for map drawing. Requires aredist_mapobject.alg_max_districts: the maximum number of districts allowed in algorithmic simulationsalg_max_sims: the maximum number of simulations allowed in algorithmic simulationsuse_planscore: whether to use the PlanScore API to evaluate plans. Requires internet access and a PlanScore key.
Several data-based options may be configured inside draw():
layers: Columns to use as toggle layers, where you can show things like county lines above the shapeselect_cols: Specify election columns directly. This use a guessing approach which follows the ALARM Project column naming schema by default.demog_cols: Specify demographic columns directly. This use a guessing approach which follows the ALARM Project column naming schema by default.split_cols: Specify columns which contain administrative units to check splits for.hover_fn: A function to display precinct-data based on the row ofshpthat the mouse is over.

