-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeserts.Rmd
38 lines (31 loc) · 1.5 KB
/
deserts.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
---
title: "Food Deserts"
output: html_document
date: '2022-07-01'
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
library(tidyverse)
library(tidycensus)
library(jsonlite)
library(ggthemes)
```
Poorer areas in many regions of the U.S don't have access to grocery stores, forcing people to walk for miles just to feed themselves. These areas are called Food Deserts, which are shown in the plot below.
```{r warning = FALSE, include = FALSE}
county_stores <- fromJSON("https://services1.arcgis.com/RLQu0rK7h4kbsBq5/arcgis/rest/services/Store_Locations/FeatureServer/0/query?where=State%20%3D%20'OH'%20AND%20County%20%3D%20'HAMILTON'&outFields=Store_Name,State,County,Longitude,Latitude&outSR=4326&f=json")
county_stores <- county_stores$features$attributes
county_map <- get_acs(geography = "tract", variables = "B06012_002", year = 2018, state = "Ohio", county = "Hamilton County", geometry = TRUE, summary_var = "B02001_001")
```
```{r}
county_map|>
mutate(Percent = (estimate / summary_est) * 100) |>
ggplot(aes(fill = Percent, color = Percent))+
geom_sf() +
scale_fill_viridis_c(direction = -1) +
scale_color_viridis_c(direction = -1) +
geom_point(data = county_stores, inherit.aes = FALSE, aes(x = Longitude, y = Latitude), size = 0.5) +
theme_void() +
labs(title = "Grocery Stores and Income in Hamilton County, Ohio",
subtitle = "A food desert is located in the center of downtown Cincinnati",
caption = "Sources: USDA Food and Nutrion Service and SNAP Retailer Locator")
```