Explanation of the template

Update the title with your information. Make sure to include identification information so that we know it is your submission.

Also update the author name and date accordingly.

Check out the Source Code from the top-right corner </>Code menu.

In the following R code chunk, load_packages is the code chunk name. include=FALSE suggests that the code chunk will run, but the code itself and its outputs will not be included in the rendered HTML. echo=TRUE in the following code chunk suggests that the code and results from running the code will be included in the rendered HTML.

R Spatial Lab Assignment # 1

Don’t use a single chunk for the entire assignment. Break it into multiple chunks.

You can name the code chunk and also set options.

task 1:

smpCode <- "hello, R markdown and RPubs!"

cat(smpCode)
## hello, R markdown and RPubs!

task 2:

Quarto markdown is different from R markdown in terms of chunk options. See chunk options at Quarto website.

print("This is the new code chunk options available in Quarto Markdown")
## [1] "This is the new code chunk options available in Quarto Markdown"
#Read in NYC postal areas by zip code
postal_codes <- st_read("data/ZIP_CODE_040114/ZIP_CODE_040114.shp")
## Reading layer `ZIP_CODE_040114' from data source 
##   `/Users/gracedarling/Desktop/Data Analysis and Visualization with R/R-spatial/data/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)
#Read in health facilities and create sf objects
nys_health_df <- read.csv("data/NYS_Health_Facility.csv")
nys_health_df <- nys_health_df[which(!is.na(nys_health_df$Facility.Latitude) & !is.na(nys_health_df$Facility.Longitude)),]

nys_health_sf <- st_as_sf(nys_health_df, 
coords = c("Facility.Longitude", "Facility.Latitude"))
#Read and process NYS food retail stores data
nys_food_df <- read.csv("data/nys_retail_food_store_xy.csv")
nys_food_df <- nys_food_df[which(!is.na(nys_food_df$X) & !is.na(nys_food_df$Y)),]
nys_food_sf <- st_as_sf(nys_food_df, coords=c("X","Y"))
st_crs(nys_health_sf) <- 4326
mapview(nys_health_sf)
st_crs(nys_food_sf) <- 4326
mapview(nys_food_sf)
mapview(postal_codes)
save(postal_codes, nys_health_sf, nys_food_sf,
file = './data/nyc/assignment7.RData')