-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.Rmd
63 lines (46 loc) · 1.87 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# alarmdata <a href="https://alarm-redist.org/alarmdata/"><img src="man/figures/logo.png" align="right" height="156" /></a>
<!-- badges: start -->
[](https://github.com/alarm-redist/alarmdata/actions)
<!-- badges: end -->
**alarmdata** provides utility functions to download and process data produced by the ALARM Project,
including [2020 redistricting files](https://alarm-redist.org/posts/2021-08-10-census-2020/)
and [50-State Redistricting Simulations](https://doi.org/10.7910/DVN/SLCD3E).
## Installation
You can install **alarmdata** with:
``` r
install.packages("alarmdata")
```
You can also install the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("remotes")
remotes::install_github("alarm-redist/alarmdata")
```
## Example
We can easily download simulation data for a state and make some plots.
```{r ex, message=FALSE}
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()`.