made edits to county graphs

This commit is contained in:
Ben Varick 2025-01-27 19:12:03 -06:00
parent 0f84c1fbf3
commit 38c3ba3fec
Signed by: ben
SSH Key Fingerprint: SHA256:jWnpFDAcacYM5aPFpYRqlsamlDyKNpSj3jj+k4ojtUo

View File

@ -141,13 +141,16 @@ for(county in county_focus) {
TOPS_data %>% TOPS_data %>%
filter(CNTYNAME %in% county) %>% filter(CNTYNAME %in% county) %>%
filter(ROLE1 %in% vuln_roles & age1 < 18 | ROLE2 %in% vuln_roles & age2 < 18) %>% filter(ROLE1 %in% vuln_roles & age1 < 18 | ROLE2 %in% vuln_roles & age2 < 18) %>%
group_by(year) %>% summarise(count = n_distinct(DOCTNMBR)) %>% filter(ped_inj %in% c("B", "A", "K")) %>%
group_by(year) %>%
summarise(count = n_distinct(DOCTNMBR)) %>%
complete(year, fill = list(count = 0)) %>%
ggplot() + ggplot() +
geom_col(aes(x = year, geom_col(aes(x = year,
y = count), y = count),
fill = "darkred") + fill = "darkred") +
scale_y_continuous(expand = expansion(mult = c(0,0.07))) + scale_y_continuous(expand = expansion(mult = c(0,0.07)), breaks = scales::pretty_breaks(min.n = 0)) +
labs(title = paste0("Pedestrians/bicyclists under 18 years old hit by cars in ", labs(title = paste0("Pedestrians/bicyclists under 18 years old killed or injured by drivers in ",
str_to_title(county), str_to_title(county),
" County"), " County"),
x = "Year", x = "Year",