R Spatial Lab Assignment # 2

task 1

Load data (zip code and food stores)

zip_codes_sf <- st_read("/Users/elvagao/Desktop/Rstudio_GTECH/R-spatial/Data/R-spatial_1_Lab/ZIP_CODE_040114/ZIP_CODE_040114.shp")
## Reading layer `ZIP_CODE_040114' from data source 
##   `/Users/elvagao/Desktop/Rstudio_GTECH/R-spatial/Data/R-Spatial_1_Lab/ZIP_CODE_040114/ZIP_CODE_040114.shp' 
##   using driver `ESRI Shapefile'
## Simple feature collection with 263 features and 12 fields
## Geometry type: POLYGON
## Dimension:     XY
## Bounding box:  xmin: 913129 ymin: 120020.9 xmax: 1067494 ymax: 272710.9
## Projected CRS: NAD83 / New York Long Island (ftUS)
food_stores_sf <- st_read('/Users/elvagao/Desktop/Rstudio_GTECH/R-spatial_2/R-spatial_ll_Lab/nycFoodStore.shp')
## Reading layer `nycFoodStore' from data source 
##   `/Users/elvagao/Desktop/Rstudio_GTECH/R-spatial_2/R-Spatial_ll_Lab/nycFoodStore.shp' 
##   using driver `ESRI Shapefile'
## Simple feature collection with 11300 features and 16 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -74.2484 ymin: 40.50782 xmax: -73.67061 ymax: 40.91008
## Geodetic CRS:  WGS 84
census_tract <- st_read("/Users/elvagao/Desktop/Rstudio_GTECH/R-spatial_2/R-spatial_ll_Lab/2010_Census_Tracts/geo_export_1dc7b645-647b-4806-b9a0-7b79660f120a.shp")
## Reading layer `geo_export_1dc7b645-647b-4806-b9a0-7b79660f120a' from data source `/Users/elvagao/Desktop/Rstudio_GTECH/R-spatial_2/R-Spatial_ll_Lab/2010_Census_Tracts/geo_export_1dc7b645-647b-4806-b9a0-7b79660f120a.shp' 
##   using driver `ESRI Shapefile'
## Simple feature collection with 2165 features and 11 fields
## Geometry type: MULTIPOLYGON
## Dimension:     XY
## Bounding box:  xmin: -74.25559 ymin: 40.49612 xmax: -73.70001 ymax: 40.91553
## Geodetic CRS:  WGS84(DD)

task 2

Load health facility data and turn to sf, have the CRS be 2263

health_facilities_csv <- read.csv("/Users/elvagao/Desktop/Rstudio_GTECH/R-spatial_2/R-spatial_ll_Lab/NYS_Health_Facility.csv")
health_facilities_csv <- health_facilities_csv %>% filter(between(Facility.Longitude, -79.8, -71.8) & between(Facility.Latitude, 40.0, 45.5)) 
health_facilities_sf <- st_as_sf(health_facilities_csv, coords = c("Facility.Longitude", "Facility.Latitude"), crs = 2263)

task 3

Load covid data and clean it

covid_data <- read.csv("/Users/elvagao/Desktop/Rstudio_GTECH/R-spatial_2/R-spatial_ll_Lab/tests-by-zcta_2021_04_23.csv")
covid_data_clean <- covid_data %>% dplyr::select(MODIFIED_ZCTA, COVID_CASE_COUNT, COVID_CASE_RATE, PERCENT_POSITIVE, TOTAL_COVID_TESTS) %>% group_by(MODIFIED_ZCTA) %>% summarize(COVID_CASE_COUNT = sum(COVID_CASE_COUNT, na.rm = TRUE), COVID_CASE_RATE = mean(COVID_CASE_RATE, na.rm = TRUE), PERCENT_POSITIVE = mean(PERCENT_POSITIVE, na.rm = TRUE), TOTAL_COVID_TESTS = sum(TOTAL_COVID_TESTS, na.rm = TRUE))

task 4

Clean covid data and join with zip code

covid_data_clean$MODIFIED_ZCTA <- as.character(covid_data_clean$MODIFIED_ZCTA)
zip_codes_sf <- zip_codes_sf %>%
  left_join(covid_data_clean, by = c("ZIPCODE" = "MODIFIED_ZCTA"))
colnames(zip_codes_sf)
##  [1] "ZIPCODE"           "BLDGZIP"           "PO_NAME"          
##  [4] "POPULATION"        "AREA"              "STATE"            
##  [7] "COUNTY"            "ST_FIPS"           "CTY_FIPS"         
## [10] "URL"               "SHAPE_AREA"        "SHAPE_LEN"        
## [13] "COVID_CASE_COUNT"  "COVID_CASE_RATE"   "PERCENT_POSITIVE" 
## [16] "TOTAL_COVID_TESTS" "geometry"
zip_codes_sf <- zip_codes_sf %>% left_join(covid_data_clean, by = c("ZIPCODE" = "MODIFIED_ZCTA"))

task 5

Filter food stores

food_stores_filtered <- food_stores_sf %>%
  filter(Oprtn_T == "Store")

task 6

Check the CRS for these 3

zip_codes_sf <- st_transform(zip_codes_sf, crs = 2263)
food_stores_sf <- st_transform(food_stores_sf, crs = 2263)
health_facilities_sf <- st_transform(health_facilities_sf, crs = 2263)

task 7

Check the column names and join food store with zip code

colnames(food_stores_sf)
##  [1] "ï__Cnty"  "Lcns_Nm"  "Oprtn_T"  "Estbl_T"  "Entty_N"  "DBA_Nam" 
##  [7] "Strt_Nmb" "Stret_Nm" "Add_L_2"  "Add_L_3"  "City"     "State"   
## [13] "Zip_Cod"  "Sqr_Ftg"  "Locatin"  "Coords"   "geometry"
food_stores_by_zip <- food_stores_sf %>% st_drop_geometry() %>% group_by(Zip_Cod) %>% summarize(store_count = n())

task 8

Mutate

food_stores_by_zip <- food_stores_by_zip %>% mutate(Zip_Cod = as.character(Zip_Cod))

task 9

View mapview of food stores with zip code

zip_covid_data_sf <- zip_codes_sf %>% left_join(covid_data_clean, by = c("ZIPCODE" = "MODIFIED_ZCTA"))
mapview(zip_covid_data_sf, zcol = "COVID_CASE_COUNT", legend = TRUE)

task 10

Read ACS data

acs_data <- read.csv("/Users/elvagao/Desktop/Rstudio_GTECH/R-spatial_2/R-spatial_ll_Lab/ACSDP5Y2018.DP05_data_with_overlays_2020-04-22T132935.csv")

task 13

Clean ACS data

acs_data_cleaned <- acs_data[, c("GEO_ID", "NAME", "DP05_0033E")]
colnames(acs_data_cleaned) <- c("GEO_ID", "Geographic_Area", "Total_Population")
head(acs_data_cleaned)
##                 GEO_ID                         Geographic_Area
## 1                   id                    Geographic Area Name
## 2 1400000US36005000100  Census Tract 1, Bronx County, New York
## 3 1400000US36005000200  Census Tract 2, Bronx County, New York
## 4 1400000US36005000400  Census Tract 4, Bronx County, New York
## 5 1400000US36005001600 Census Tract 16, Bronx County, New York
## 6 1400000US36005001900 Census Tract 19, Bronx County, New York
##                   Total_Population
## 1 Estimate!!RACE!!Total population
## 2                             7080
## 3                             4542
## 4                             5634
## 5                             5917
## 6                             2765

task 14

See column names for 2010 census tract

colnames(census_tract)
##  [1] "boro_code"  "boro_ct201" "boro_name"  "cdeligibil" "ct2010"    
##  [6] "ctlabel"    "ntacode"    "ntaname"    "puma"       "shape_area"
## [11] "shape_leng" "geometry"

task 15

Clean ACS data and look at similar thing for zip code and ACS, if none, create one.

acs_data_cleaned$GEO_ID <- as.character(acs_data_cleaned$GEO_ID)
zip_codes_sf$ZIPCODE <- as.character(zip_codes_sf$ZIPCODE)

task 16

Join ACS and zip code data

zip_acs_sf <- zip_codes_sf %>% left_join(acs_data_cleaned, by = c("ZIPCODE" = "GEO_ID"))
head(zip_acs_sf)
## Simple feature collection with 6 features and 22 fields
## Geometry type: POLYGON
## Dimension:     XY
## Bounding box:  xmin: 986490.1 ymin: 168910.5 xmax: 1043042 ymax: 189382.9
## Projected CRS: NAD83 / New York Long Island (ftUS)
##   ZIPCODE BLDGZIP  PO_NAME POPULATION     AREA STATE COUNTY ST_FIPS CTY_FIPS
## 1   11436       0  Jamaica      18681 22699295    NY Queens      36      081
## 2   11213       0 Brooklyn      62426 29631004    NY  Kings      36      047
## 3   11212       0 Brooklyn      83866 41972104    NY  Kings      36      047
## 4   11225       0 Brooklyn      56527 23698630    NY  Kings      36      047
## 5   11218       0 Brooklyn      72280 36868799    NY  Kings      36      047
## 6   11226       0 Brooklyn     106132 39408598    NY  Kings      36      047
##                    URL SHAPE_AREA SHAPE_LEN COVID_CASE_COUNT.x
## 1 http://www.usps.com/          0         0               1888
## 2 http://www.usps.com/          0         0               5166
## 3 http://www.usps.com/          0         0               7182
## 4 http://www.usps.com/          0         0               3833
## 5 http://www.usps.com/          0         0               6199
## 6 http://www.usps.com/          0         0               7279
##   COVID_CASE_RATE.x PERCENT_POSITIVE.x TOTAL_COVID_TESTS.x COVID_CASE_COUNT.y
## 1           9419.96              17.57               11082               1888
## 2           7996.75              13.72               38560               5166
## 3           9709.74              15.64               47319               7182
## 4           6664.50              11.62               33709               3833
## 5           8377.49              13.93               45884               6199
## 6           7476.75              13.33               56287               7279
##   COVID_CASE_RATE.y PERCENT_POSITIVE.y TOTAL_COVID_TESTS.y Geographic_Area
## 1           9419.96              17.57               11082            <NA>
## 2           7996.75              13.72               38560            <NA>
## 3           9709.74              15.64               47319            <NA>
## 4           6664.50              11.62               33709            <NA>
## 5           8377.49              13.93               45884            <NA>
## 6           7476.75              13.33               56287            <NA>
##   Total_Population                       geometry
## 1             <NA> POLYGON ((1038098 188138.4,...
## 2             <NA> POLYGON ((1001614 186926.4,...
## 3             <NA> POLYGON ((1011174 183696.3,...
## 4             <NA> POLYGON ((995908.4 183617.6...
## 5             <NA> POLYGON ((991997.1 176307.5...
## 6             <NA> POLYGON ((994821.5 177865.7...

task 17

Check for NA

zip_acs_sf %>% filter(is.na(Geographic_Area) | is.na(Total_Population))
## Simple feature collection with 263 features and 22 fields
## Geometry type: POLYGON
## Dimension:     XY
## Bounding box:  xmin: 913129 ymin: 120020.9 xmax: 1067494 ymax: 272710.9
## Projected CRS: NAD83 / New York Long Island (ftUS)
## First 10 features:
##    ZIPCODE BLDGZIP  PO_NAME POPULATION     AREA STATE COUNTY ST_FIPS CTY_FIPS
## 1    11436       0  Jamaica      18681 22699295    NY Queens      36      081
## 2    11213       0 Brooklyn      62426 29631004    NY  Kings      36      047
## 3    11212       0 Brooklyn      83866 41972104    NY  Kings      36      047
## 4    11225       0 Brooklyn      56527 23698630    NY  Kings      36      047
## 5    11218       0 Brooklyn      72280 36868799    NY  Kings      36      047
## 6    11226       0 Brooklyn     106132 39408598    NY  Kings      36      047
## 7    11219       0 Brooklyn      92561 42002738    NY  Kings      36      047
## 8    11210       0 Brooklyn      67067 47887023    NY  Kings      36      047
## 9    11230       0 Brooklyn      80857 49926703    NY  Kings      36      047
## 10   11204       0 Brooklyn      77354 43555185    NY  Kings      36      047
##                     URL SHAPE_AREA SHAPE_LEN COVID_CASE_COUNT.x
## 1  http://www.usps.com/          0         0               1888
## 2  http://www.usps.com/          0         0               5166
## 3  http://www.usps.com/          0         0               7182
## 4  http://www.usps.com/          0         0               3833
## 5  http://www.usps.com/          0         0               6199
## 6  http://www.usps.com/          0         0               7279
## 7  http://www.usps.com/          0         0               8429
## 8  http://www.usps.com/          0         0               5380
## 9  http://www.usps.com/          0         0              11044
## 10 http://www.usps.com/          0         0               7331
##    COVID_CASE_RATE.x PERCENT_POSITIVE.x TOTAL_COVID_TESTS.x COVID_CASE_COUNT.y
## 1            9419.96              17.57               11082               1888
## 2            7996.75              13.72               38560               5166
## 3            9709.74              15.64               47319               7182
## 4            6664.50              11.62               33709               3833
## 5            8377.49              13.93               45884               6199
## 6            7476.75              13.33               56287               7279
## 7            9356.97              15.64               55444               8429
## 8            8190.36              15.60               35070               5380
## 9           12424.46              19.11               59585              11044
## 10           9509.97              17.29               43449               7331
##    COVID_CASE_RATE.y PERCENT_POSITIVE.y TOTAL_COVID_TESTS.y Geographic_Area
## 1            9419.96              17.57               11082            <NA>
## 2            7996.75              13.72               38560            <NA>
## 3            9709.74              15.64               47319            <NA>
## 4            6664.50              11.62               33709            <NA>
## 5            8377.49              13.93               45884            <NA>
## 6            7476.75              13.33               56287            <NA>
## 7            9356.97              15.64               55444            <NA>
## 8            8190.36              15.60               35070            <NA>
## 9           12424.46              19.11               59585            <NA>
## 10           9509.97              17.29               43449            <NA>
##    Total_Population                       geometry
## 1              <NA> POLYGON ((1038098 188138.4,...
## 2              <NA> POLYGON ((1001614 186926.4,...
## 3              <NA> POLYGON ((1011174 183696.3,...
## 4              <NA> POLYGON ((995908.4 183617.6...
## 5              <NA> POLYGON ((991997.1 176307.5...
## 6              <NA> POLYGON ((994821.5 177865.7...
## 7              <NA> POLYGON ((987286.4 173946.5...
## 8              <NA> POLYGON ((995796 171110.1, ...
## 9              <NA> POLYGON ((994099.3 171240.7...
## 10             <NA> POLYGON ((989500.2 170730.2...

task 18

The sum of the NA

sum(is.na(zip_acs_sf$Total_Population))
## [1] 263

task 19

Clean ACS with zip code for Total population

zip_acs_sf_cleaned <- zip_acs_sf[!is.na(zip_acs_sf$Total_Population), ]

task 20

How is it class

class(zip_acs_sf$Total_Population)
## [1] "character"

task 21

Zip code with ACS for total population as a numerically value

zip_acs_sf$Total_Population <- as.numeric(zip_acs_sf$Total_Population)

task 22

The sum of the total population having data with zip code

zip_acs_sf$Total_Population <- as.numeric(zip_acs_sf$Total_Population)
sum(is.na(zip_acs_sf$Total_Population))
## [1] 263

task 24

See the summary of zip code with acs

summary(zip_acs_sf$Total_Population)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##      NA      NA      NA     NaN      NA      NA     263
table(is.na(zip_acs_sf$Total_Population))
## 
## TRUE 
##  263

task 25

See again the column names and head

colnames(zip_acs_sf)
##  [1] "ZIPCODE"             "BLDGZIP"             "PO_NAME"            
##  [4] "POPULATION"          "AREA"                "STATE"              
##  [7] "COUNTY"              "ST_FIPS"             "CTY_FIPS"           
## [10] "URL"                 "SHAPE_AREA"          "SHAPE_LEN"          
## [13] "COVID_CASE_COUNT.x"  "COVID_CASE_RATE.x"   "PERCENT_POSITIVE.x" 
## [16] "TOTAL_COVID_TESTS.x" "COVID_CASE_COUNT.y"  "COVID_CASE_RATE.y"  
## [19] "PERCENT_POSITIVE.y"  "TOTAL_COVID_TESTS.y" "Geographic_Area"    
## [22] "Total_Population"    "geometry"
head(zip_acs_sf)
## Simple feature collection with 6 features and 22 fields
## Geometry type: POLYGON
## Dimension:     XY
## Bounding box:  xmin: 986490.1 ymin: 168910.5 xmax: 1043042 ymax: 189382.9
## Projected CRS: NAD83 / New York Long Island (ftUS)
##   ZIPCODE BLDGZIP  PO_NAME POPULATION     AREA STATE COUNTY ST_FIPS CTY_FIPS
## 1   11436       0  Jamaica      18681 22699295    NY Queens      36      081
## 2   11213       0 Brooklyn      62426 29631004    NY  Kings      36      047
## 3   11212       0 Brooklyn      83866 41972104    NY  Kings      36      047
## 4   11225       0 Brooklyn      56527 23698630    NY  Kings      36      047
## 5   11218       0 Brooklyn      72280 36868799    NY  Kings      36      047
## 6   11226       0 Brooklyn     106132 39408598    NY  Kings      36      047
##                    URL SHAPE_AREA SHAPE_LEN COVID_CASE_COUNT.x
## 1 http://www.usps.com/          0         0               1888
## 2 http://www.usps.com/          0         0               5166
## 3 http://www.usps.com/          0         0               7182
## 4 http://www.usps.com/          0         0               3833
## 5 http://www.usps.com/          0         0               6199
## 6 http://www.usps.com/          0         0               7279
##   COVID_CASE_RATE.x PERCENT_POSITIVE.x TOTAL_COVID_TESTS.x COVID_CASE_COUNT.y
## 1           9419.96              17.57               11082               1888
## 2           7996.75              13.72               38560               5166
## 3           9709.74              15.64               47319               7182
## 4           6664.50              11.62               33709               3833
## 5           8377.49              13.93               45884               6199
## 6           7476.75              13.33               56287               7279
##   COVID_CASE_RATE.y PERCENT_POSITIVE.y TOTAL_COVID_TESTS.y Geographic_Area
## 1           9419.96              17.57               11082            <NA>
## 2           7996.75              13.72               38560            <NA>
## 3           9709.74              15.64               47319            <NA>
## 4           6664.50              11.62               33709            <NA>
## 5           8377.49              13.93               45884            <NA>
## 6           7476.75              13.33               56287            <NA>
##   Total_Population                       geometry
## 1               NA POLYGON ((1038098 188138.4,...
## 2               NA POLYGON ((1001614 186926.4,...
## 3               NA POLYGON ((1011174 183696.3,...
## 4               NA POLYGON ((995908.4 183617.6...
## 5               NA POLYGON ((991997.1 176307.5...
## 6               NA POLYGON ((994821.5 177865.7...

task 26

Rename ‘POPULATION’ to ‘Total_Population’

zip_acs_sf$Total_Population <- zip_acs_sf$POPULATION

task 27

Clean zip code with ACS

zip_acs_sf_cleaned <- zip_acs_sf[!is.na(zip_acs_sf$Total_Population), ]

task 28

The header of the new clean version

head(zip_acs_sf_cleaned)
## Simple feature collection with 6 features and 22 fields
## Geometry type: POLYGON
## Dimension:     XY
## Bounding box:  xmin: 986490.1 ymin: 168910.5 xmax: 1043042 ymax: 189382.9
## Projected CRS: NAD83 / New York Long Island (ftUS)
##   ZIPCODE BLDGZIP  PO_NAME POPULATION     AREA STATE COUNTY ST_FIPS CTY_FIPS
## 1   11436       0  Jamaica      18681 22699295    NY Queens      36      081
## 2   11213       0 Brooklyn      62426 29631004    NY  Kings      36      047
## 3   11212       0 Brooklyn      83866 41972104    NY  Kings      36      047
## 4   11225       0 Brooklyn      56527 23698630    NY  Kings      36      047
## 5   11218       0 Brooklyn      72280 36868799    NY  Kings      36      047
## 6   11226       0 Brooklyn     106132 39408598    NY  Kings      36      047
##                    URL SHAPE_AREA SHAPE_LEN COVID_CASE_COUNT.x
## 1 http://www.usps.com/          0         0               1888
## 2 http://www.usps.com/          0         0               5166
## 3 http://www.usps.com/          0         0               7182
## 4 http://www.usps.com/          0         0               3833
## 5 http://www.usps.com/          0         0               6199
## 6 http://www.usps.com/          0         0               7279
##   COVID_CASE_RATE.x PERCENT_POSITIVE.x TOTAL_COVID_TESTS.x COVID_CASE_COUNT.y
## 1           9419.96              17.57               11082               1888
## 2           7996.75              13.72               38560               5166
## 3           9709.74              15.64               47319               7182
## 4           6664.50              11.62               33709               3833
## 5           8377.49              13.93               45884               6199
## 6           7476.75              13.33               56287               7279
##   COVID_CASE_RATE.y PERCENT_POSITIVE.y TOTAL_COVID_TESTS.y Geographic_Area
## 1           9419.96              17.57               11082            <NA>
## 2           7996.75              13.72               38560            <NA>
## 3           9709.74              15.64               47319            <NA>
## 4           6664.50              11.62               33709            <NA>
## 5           8377.49              13.93               45884            <NA>
## 6           7476.75              13.33               56287            <NA>
##   Total_Population                       geometry
## 1            18681 POLYGON ((1038098 188138.4,...
## 2            62426 POLYGON ((1001614 186926.4,...
## 3            83866 POLYGON ((1011174 183696.3,...
## 4            56527 POLYGON ((995908.4 183617.6...
## 5            72280 POLYGON ((991997.1 176307.5...
## 6           106132 POLYGON ((994821.5 177865.7...

task 29

Aggregating COVID-19 data (assuming ‘zip_acs_sf_cleaned’ contains the necessary columns)

zip_covid_agg <- zip_acs_sf_cleaned %>% group_by(ZIPCODE) %>% summarise(total_cases = sum(COVID_CASE_COUNT.x, na.rm = TRUE), total_tests = sum(TOTAL_COVID_TESTS.x, na.rm = TRUE), case_rate = mean(COVID_CASE_RATE.x, na.rm = TRUE), percent_positive = mean(PERCENT_POSITIVE.x, na.rm = TRUE))

task 30

Join with zip code aggregated and clean

zip_acs_sf_cleaned <- st_join(zip_acs_sf_cleaned, zip_covid_agg, by = "ZIPCODE")

task 31

The clean zip with ACs with dropped NA values

zip_acs_sf_cleaned <- drop_na(zip_acs_sf_cleaned, Total_Population)

task 32

summary(zip_acs_sf_cleaned)
##   ZIPCODE.x           BLDGZIP            PO_NAME            POPULATION    
##  Length:1240        Length:1240        Length:1240        Min.   :     0  
##  Class :character   Class :character   Class :character   1st Qu.: 17513  
##  Mode  :character   Mode  :character   Mode  :character   Median : 37743  
##                                                           Mean   : 40557  
##                                                           3rd Qu.: 62075  
##                                                           Max.   :109069  
##                                                                           
##       AREA              STATE              COUNTY            ST_FIPS         
##  Min.   :     3155   Length:1240        Length:1240        Length:1240       
##  1st Qu.: 11395111   Class :character   Class :character   Class :character  
##  Median : 29593164   Mode  :character   Mode  :character   Mode  :character  
##  Mean   : 40086886                                                           
##  3rd Qu.: 53463275                                                           
##  Max.   :473985727                                                           
##                                                                              
##    CTY_FIPS             URL              SHAPE_AREA   SHAPE_LEN
##  Length:1240        Length:1240        Min.   :0    Min.   :0  
##  Class :character   Class :character   1st Qu.:0    1st Qu.:0  
##  Mode  :character   Mode  :character   Median :0    Median :0  
##                                        Mean   :0    Mean   :0  
##                                        3rd Qu.:0    3rd Qu.:0  
##                                        Max.   :0    Max.   :0  
##                                                                
##  COVID_CASE_COUNT.x COVID_CASE_RATE.x PERCENT_POSITIVE.x TOTAL_COVID_TESTS.x
##  Min.   :  164      Min.   : 3413     Min.   : 5.50      Min.   : 2441      
##  1st Qu.: 1917      1st Qu.: 6308     1st Qu.: 9.67      1st Qu.:18417      
##  Median : 3469      Median : 8500     Median :14.93      Median :28077      
##  Mean   : 4260      Mean   : 8332     Mean   :13.62      Mean   :30998      
##  3rd Qu.: 6199      3rd Qu.:10096     3rd Qu.:16.87      3rd Qu.:43954      
##  Max.   :11581      Max.   :16212     Max.   :21.10      Max.   :72559      
##  NA's   :195        NA's   :195       NA's   :195        NA's   :195        
##  COVID_CASE_COUNT.y COVID_CASE_RATE.y PERCENT_POSITIVE.y TOTAL_COVID_TESTS.y
##  Min.   :  164      Min.   : 3413     Min.   : 5.50      Min.   : 2441      
##  1st Qu.: 1917      1st Qu.: 6308     1st Qu.: 9.67      1st Qu.:18417      
##  Median : 3469      Median : 8500     Median :14.93      Median :28077      
##  Mean   : 4260      Mean   : 8332     Mean   :13.62      Mean   :30998      
##  3rd Qu.: 6199      3rd Qu.:10096     3rd Qu.:16.87      3rd Qu.:43954      
##  Max.   :11581      Max.   :16212     Max.   :21.10      Max.   :72559      
##  NA's   :195        NA's   :195       NA's   :195        NA's   :195        
##  Geographic_Area    Total_Population  ZIPCODE.y          total_cases   
##  Length:1240        Min.   :     0   Length:1240        Min.   :    0  
##  Class :character   1st Qu.: 17513   Class :character   1st Qu.: 1314  
##  Mode  :character   Median : 37743   Mode  :character   Median : 2971  
##                     Mean   : 40557                      Mean   : 3690  
##                     3rd Qu.: 62075                      3rd Qu.: 5707  
##                     Max.   :109069                      Max.   :12746  
##                                                                        
##   total_tests      case_rate     percent_positive          geometry   
##  Min.   :    0   Min.   : 3413   Min.   : 5.50    POLYGON      :1240  
##  1st Qu.:12107   1st Qu.: 6308   1st Qu.: 9.67    epsg:2263    :   0  
##  Median :24610   Median : 8500   Median :14.93    +proj=lcc ...:   0  
##  Mean   :26898   Mean   : 8329   Mean   :13.61                        
##  3rd Qu.:41474   3rd Qu.:10096   3rd Qu.:16.87                        
##  Max.   :91518   Max.   :16212   Max.   :21.10                        
##                  NA's   :193     NA's   :193

task 33

Plot of covid in ZIP CODE

ggplot(zip_acs_sf_cleaned) + geom_sf(aes(fill = COVID_CASE_RATE.x)) + scale_fill_viridis_c() + theme_minimal() + labs(title = "COVID-19 Case Rate by ZIP Code")