This project investigates the spatial distribution of hospitals in Fulton and DeKalb counties, Georgia, with a focus on understanding how various socioeconomic factors influence healthcare access across different neighborhoods. Utilizing Point of Interest (POI) data from Yelp alongside American Community Survey (ACS) data, this analysis aims to identify potential inequities in hospital accessibility among different demographic groups. By examining key variables such as median household income, poverty status, and population density, the project seeks to highlight disparities in healthcare access and inform discussions on the need for equitable healthcare resources in these urban areas. Through spatial analysis and visualizations, I aim to answer the critical question: Is the spatial distribution of hospitals in Fulton and DeKalb counties equitable?
# Load necessary libraries
library(sf)
library(tidycensus)
## Warning: package 'tidycensus' was built under R version 4.3.3
library(dplyr)
library(ggplot2)
library(tmap)
library(tidyr)
tidycensus::census_api_key(Sys.getenv("Census_API")) #importing census API key from environment
## To install your API key for use in future sessions, run this function with `install = TRUE`.
hospitals <- st_read("https://raw.githubusercontent.com/ujhwang/urban-analytics-2024/main/Assignment/mini_3/yelp_hospital.geojson")
## Reading layer `yelp_hospital' from data source
## `https://raw.githubusercontent.com/ujhwang/urban-analytics-2024/main/Assignment/mini_3/yelp_hospital.geojson'
## using driver `GeoJSON'
## Simple feature collection with 129 features and 23 fields
## Geometry type: POINT
## Dimension: XY
## Bounding box: xmin: -84.56242 ymin: 33.60009 xmax: -84.08677 ymax: 34.0701
## Geodetic CRS: WGS 84
tract <- suppressMessages(
get_acs(geography = "tract",
state = "GA",
county = c("Fulton", "Dekalb"),
# chose 3 variables: median house hold income, poverty status, and population
variables = c(hhincome = 'B19019_001E',
poverty = 'B17001_001E',
population = 'B01003_001E'),
year = 2021,
survey = "acs5", # American Community Survey 5-year estimate
geometry = TRUE, # returns sf objects
output = "wide") # wide vs. long
)
#dropping NAs of both data sets
tract2 <- tract %>%
drop_na()
hospitals2 <- hospitals %>%
drop_na()
tract2 <- st_transform(tract2, crs = st_crs(hospitals2)) # Ensure both data sets have the same CRS, which is needed to join
hospital_with_acs <-
st_join(tract2, hospitals2) #joining data sets
buffer_distance <- 0.25 * 1609.34 # 0.25 miles converted to ~402 meters
epsg_id <- 4326
tract2_projected <- tract2 %>% # Transform the tract polygons to a projected CRS
st_transform(crs = epsg_id)
tract_centroids <- tract2_projected %>% # Calculate the centroid for each tract
st_centroid()
## Warning: st_centroid assumes attributes are constant over geometries
centroid_buffers <- tract_centroids %>% # Apply buffer around each centroid using sf::st_buffer
st_buffer(dist = buffer_distance)
tmap_mode('view')
## tmap mode set to interactive viewing
tm_shape(tract2_projected) +
tm_polygons(col = 'lightblue') +
tm_shape(centroid_buffers) +
tm_polygons(alpha = 0.5, col = 'red')