Week 9 Assignment

Task 1 - Individual Maps

library(sf)
## Warning: package 'sf' was built under R version 4.4.3
## Linking to GEOS 3.13.0, GDAL 3.8.5, PROJ 9.5.1; sf_use_s2() is TRUE
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.4.3
acsCovidDAT <- st_read("~/Documents/Rstudio/Week 9/acsPopByZip.gpkg")
## Reading layer `NYC_COVID_Pop_by_Zip' from data source 
##   `/Users/uwu/Documents/Rstudio/Week 9/acsPopByZip.gpkg' using driver `GPKG'
## Simple feature collection with 180 features and 13 fields
## Geometry type: MULTIPOLYGON
## Dimension:     XY
## Bounding box:  xmin: 913129 ymin: 120020.9 xmax: 1067113 ymax: 272710.9
## Projected CRS: NAD83 / New York Long Island (ftUS)
# Map 1: Covid
map1 <- ggplot(acsCovidDAT) +
  geom_sf(aes(fill = Positiv)) +
  scale_fill_distiller(palette = "OrRd") +
  labs(
    title = "Covid Cases by ZIP Code",
    fill = "Cases",
    x = "Longitude",
    y = "Latitude"
  ) +
  theme_minimal()

map1

# Map 2: Elderly population
map2 <- ggplot(acsCovidDAT) +
  geom_sf(aes(fill = eldrlyP)) +
  scale_fill_distiller(palette = "YlGnBu") +
  labs(
    title = "Elderly Population by ZIP Code",
    fill = "Population",
    x = "Longitude",
    y = "Latitude"
) +
theme_minimal()

map2

Task 2 - Side by Side Chloropeth Maps

library(patchwork)

map1 + map2 

Task 3 - Interactive Map