-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path01-rough-draft.qmd
96 lines (75 loc) · 2.21 KB
/
01-rough-draft.qmd
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
---
title: "Polling Places Report - Alabama"
author: "Isabella Velásquez"
date: today
format:
html:
embed-resources: true
execute:
echo: false
message: false
warning: false
---
In this report, we present a detailed overview of polling places in various counties across the United States, providing information on the total number of polling places and showcasing example locations for each county on election day.[^1]
[^1]: Data from https://github.com/rfordatascience/tidytuesday
```{r}
#| label: setup
library(readr)
library(dplyr)
library(tidyr)
library(tidycensus)
library(tigris)
library(sf)
library(ggplot2)
library(purrr)
library(kableExtra)
polling_places <- read_csv(here::here("data", "geocoded_polling_places.csv"))
```
## Alabama
### Overview
:::: {layout-ncol="2"}
::: {}
* Total number of counties: **`r polling_places |> filter(state == "Alabama") |> distinct(county_name) |> count()`**
* Total number of polling places: **`r polling_places |> filter(state == "Alabama") |> count()`**
* Election Day: **`r polling_places |> filter(state == "Alabama") |> pull(election_date) |> unique()`**
:::
::: {}
```{r}
#| label: "fig-statemap"
#| fig-cap: "Polling locations in the state"
#| results: hide
us_states <- states(cb = TRUE, resolution = "20m") |>
filter(NAME != "Puerto Rico")
ggplot(us_states |> filter(NAME == "Alabama")) +
geom_sf() +
geom_point(data = polling_places |> filter(state == "Alabama"),
aes(x = longitude,
y = latitude),
alpha = 0.4) +
theme_void()
```
:::
::::
{{< pagebreak >}}
### POLLING PLACES BY COUNTY
See polling place locations in @fig-statemap.
#### AUTAUGA
* Total polling places: `r polling_places |> filter(state == "Alabama", county_name == "AUTAUGA") |> count()`
* Example locations:
```{r}
polling_places |>
filter(state == "Alabama", county_name == "AUTAUGA") |>
head(6) |>
select(name) |>
kbl(format = "markdown")
```
#### BALDWIN
* Total Polling Places: `r polling_places |> filter(state == "Alabama", county_name == "BALDWIN") |> count()`
* Example Locations:
```{r}
polling_places |>
filter(state == "Alabama", county_name == "BALDWIN") |>
head(6) |>
select(name) |>
kbl(format = "markdown")
```