Use ggplot2 and other ggplot-compatible packages to create a
multi-map figure illustrating the possible relationship between COVID-19
confirmed cases or rate and another factor (e.g., the number of nursing
homes, number of food stores, neighborhood racial composition, elderly
population, etc.). The maps should be put side by side on one single
page. Add graticule to at least one of those maps and label some of the
feature on the map where applicable and appropriate.
ggplot(NYC_Final)+
geom_sf(aes(fill=COVID_CASE_COUNT))+
geom_sf(aes(fill=whitePop))

breaks_VidCount <- classIntervals(c(min(NYC_Final$COVID_CASE_COUNT) - .00001,
NYC_Final$COVID_CASE_COUNT), n = 6, style = "quantile") # creates 6 catagories
#creates a new column to store the new labeled categories and sorts by count into them
NYC_Final <- mutate(NYC_Final,
covid_cat = cut(COVID_CASE_COUNT, breaks_VidCount$brks,
labels = c("Extremely Low", "Very Low", "Low", "Moderate", "High", "Very High"),# Labels here so the key will look nice
dig.lab = 4, digits=1))
#plot:
plot1 <- ggplot(NYC_Final) +
geom_sf(aes(fill=covid_cat))+
scale_fill_brewer(palette = rev("Greens"), name='Covid Case Amounts') +
labs(x='Longitude', y='Latitude',
title='NYC Covid Case Counts')+
coord_sf(crs = st_crs(2263))
##Same Idea for plot 2, create breaks, then new columnn and sort by catagory
breaks_stores <- classIntervals(c(min(NYC_Final$n_stores) - .00001,
NYC_Final$n_stores), n = 5, style = "quantile") # creates 5 categories
## Warning in classIntervals(c(min(NYC_Final$n_stores) - 1e-05,
## NYC_Final$n_stores), : var has missing values, omitted in finding classes
#creates a new column to store the new labeled categories and sorts by count into them
NYC_Final <- mutate(NYC_Final,
store_cat = cut(n_stores, breaks_stores$brks,
labels = c("Very Low", "Low", "Moderate", "High", "Very High"),# Labels here so the key will look nice
dig.lab = 4, digits=1))
plot2<- ggplot(NYC_Final) +
geom_sf(aes(fill=store_cat))+
scale_fill_brewer(palette = "Reds", name='Food Store Amounts') +
labs(x='Longitude', y='Latitude',
title='NYC Food Store Counts')+
coord_sf(crs = st_crs(2263))
##Plotted both maps side by side
ggarrange(plot1, plot2, nrow = 1, ncol = 2)
