R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

getwd()
## [1] "/Users/kylasavino/Desktop/IND_S_R/Section_3/Session_8"
covid1 <- st_read("/Users/kylasavino/Desktop/IND_S_R/Section_3/Session_8/R-Spatial_II_Lab/tests-by-zcta_2020_04_12.csv")
## Reading layer `tests-by-zcta_2020_04_12' from data source 
##   `/Users/kylasavino/Desktop/IND_S_R/Section_3/Session_8/R-Spatial_II_Lab/tests-by-zcta_2020_04_12.csv' 
##   using driver `CSV'
## Warning: no simple feature geometries present: returning a data.frame or tbl_df
covid1 <- covid1[-c(1),]

covid3 <- st_read("/Users/kylasavino/Desktop/IND_S_R/Section_3/Session_8/R-Spatial_II_Lab/tests-by-zcta_2021_04_23.csv")
## Reading layer `tests-by-zcta_2021_04_23' from data source 
##   `/Users/kylasavino/Desktop/IND_S_R/Section_3/Session_8/R-Spatial_II_Lab/tests-by-zcta_2021_04_23.csv' 
##   using driver `CSV'
## Warning: no simple feature geometries present: returning a data.frame or tbl_df
health_fac <- st_read("/Users/kylasavino/Desktop/IND_S_R/Section_3/Session_8/R-Spatial_II_Lab/NYS_Health_Facility.csv")
## Reading layer `NYS_Health_Facility' from data source 
##   `/Users/kylasavino/Desktop/IND_S_R/Section_3/Session_8/R-Spatial_II_Lab/NYS_Health_Facility.csv' 
##   using driver `CSV'
## Warning: no simple feature geometries present: returning a data.frame or tbl_df
foodstore <- st_read("/Users/kylasavino/Desktop/IND_S_R/Section_3/Session_8/R-Spatial_II_Lab/nycFoodStore.shp")
## Reading layer `nycFoodStore' from data source 
##   `/Users/kylasavino/Desktop/IND_S_R/Section_3/Session_8/R-Spatial_II_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
acs <- st_read("/Users/kylasavino/Desktop/IND_S_R/Section_3/Session_8/R-Spatial_II_Lab/ACSDP5Y2018.DP05_data_with_overlays_2020-04-22T132935.csv")
## Reading layer `ACSDP5Y2018.DP05_data_with_overlays_2020-04-22T132935' from data source `/Users/kylasavino/Desktop/IND_S_R/Section_3/Session_8/R-Spatial_II_Lab/ACSDP5Y2018.DP05_data_with_overlays_2020-04-22T132935.csv' 
##   using driver `CSV'
## Warning: no simple feature geometries present: returning a data.frame or tbl_df
nycpop_census <- st_read("/Users/kylasavino/Desktop/IND_S_R/Section_3/Session_8/R-Spatial_II_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/kylasavino/Desktop/IND_S_R/Section_3/Session_8/R-Spatial_II_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)
covidtotal <- cbind(covid1,covid3)
foodstore$Zip_Cod <- as.character(foodstore$Zip_Cod)


#covid to food store bind
covid_food_zip <- covidtotal %>%
  left_join(foodstore,
            by= c("MODZCTA" = "Zip_Cod"))

nyc_health_facilities <- nycpop_census %>%
  left_join(health_fac,
            by=c("boro_name" = "Facility.City"))
## Warning in sf_column %in% names(g): Detected an unexpected many-to-many relationship between `x` and `y`.
## ℹ Row 1 of `x` matches multiple rows in `y`.
## ℹ Row 1131 of `y` matches multiple rows in `x`.
## ℹ If a many-to-many relationship is expected, set `relationship =
##   "many-to-many"` to silence this warning.
unique(nyc_health_facilities$Description)
##  [1] "Hospital Extension Clinic"                                    
##  [2] "School Based Hospital Extension Clinic"                       
##  [3] "Residential Health Care Facility - SNF"                       
##  [4] "Diagnostic and Treatment Center Extension Clinic"             
##  [5] "Diagnostic and Treatment Center"                              
##  [6] "Hospital"                                                     
##  [7] "School Based Diagnostic and Treatment Center Extension Clinic"
##  [8] "Long Term Home Health Care Program"                           
##  [9] "Hospice"                                                      
## [10] "Certified Home Health Agency"                                 
## [11] "Mobile Hospital Extension Clinic"                             
## [12] "Mobile Diagnostic and Treatment Center Extension Clinic"      
## [13] "Adult Day Health Care Program - Offsite"
acs_unique <- select(acs, c('GEO_ID','NAME','DP05_0033PE', 'DP05_0002PE','DP05_0003PE', 'DP05_0029PE'))

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.