Download, Merge, and Process Redistricting Data

Utility functions to download and process data produced by the ALARM Project, including 2020 redistricting files Kenny and McCartan (2021) < https://alarm-redist.org/posts/2021-08-10-census-2020/> and the 50-State Redistricting Simulations of McCartan, Kenny, Simko, Garcia, Wang, Wu, Kuriwaki, and Imai (2022) . The package extends the data introduced in McCartan, Kenny, Simko, Garcia, Wang, Wu, Kuriwaki, and Imai (2022) to also include states with only a single district. The package also includes the Japanese 2022 redistricting files from the 47-Prefecture Redistricting Simulations of Miyazaki, Yamada, Yatsuhashi, and Imai (2022) .


alarmdata

R-CMD-check

alarmdata provides utility functions to download and process data produced by the ALARM Project, including 2020 redistricting files and 50-State Redistricting Simulations.

Installation

You can install alarmdata with:

install.packages("alarmdata")

You can also install the development version from GitHub with:

# install.packages("remotes")
remotes::install_github("alarm-redist/alarmdata")

Example

We can easily download simulation data for a state and make some plots.

library(alarmdata)
library(redist)

map_wa = alarm_50state_map("WA")
plans_wa = alarm_50state_plans("WA")

redist.plot.plans(plans_wa, draws=1:4, shp=map_wa)

hist(plans_wa, e_dem) +
    ggplot2::labs(x=NULL, title="Expected Democratic seats")

Downloads will go to options(alarm.cache_dir) if it is set. If it is not, and options(alarm.use_cache = TRUE), downloads will be cached between sessions in rappdirs::user_cache_dir("alarm"). If If options(alarm.use_cache = FALSE) (the default), then the cache will be in a temporary directory that does not persist between sessions. You can check the size of the cache and clear it with alarm_cache_size() and alarm_cache_clear().

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("alarmdata")

0.2.4 by Christopher T. Kenny, 10 months ago


https://github.com/alarm-redist/alarmdata/, https://alarm-redist.org/alarmdata/


Report a bug at https://github.com/alarm-redist/alarmdata/issues/


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


Authors: Cory McCartan [aut] , Christopher T. Kenny [aut, cre] (ORCID: , Tyler Simko [aut] , Michael Zhao [aut] , Sho Miyazaki [aut] , Kosuke Imai [aut]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports rlang, cli, curl, dplyr, readr, stringr, sf, dataverse, censable, geomander, tidyselect, redist, redistmetrics, tinytiger, rappdirs

Suggests rstudioapi, rmapshaper, testthat, spelling


Imported by redistverse.


See at CRAN