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"
##Task 2: Reading the NYC postal areas in Shapefiles into sf objects

#read in shapefile
nyc_sf <- st_read("DATA_Week7/Postcode/ZIP_CODE_040114.shp")
## Reading layer `ZIP_CODE_040114' from data source 
##   `/Users/jiadavalenza/Desktop/spring 2025/GTECH 385/Spatial R/Week 7/DATA_Week7/Postcode/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)
#looking at the shapefile
str(nyc_sf)
## Classes 'sf' and 'data.frame':   263 obs. of  13 variables:
##  $ ZIPCODE   : chr  "11436" "11213" "11212" "11225" ...
##  $ BLDGZIP   : chr  "0" "0" "0" "0" ...
##  $ PO_NAME   : chr  "Jamaica" "Brooklyn" "Brooklyn" "Brooklyn" ...
##  $ POPULATION: num  18681 62426 83866 56527 72280 ...
##  $ AREA      : num  22699295 29631004 41972104 23698630 36868799 ...
##  $ STATE     : chr  "NY" "NY" "NY" "NY" ...
##  $ COUNTY    : chr  "Queens" "Kings" "Kings" "Kings" ...
##  $ ST_FIPS   : chr  "36" "36" "36" "36" ...
##  $ CTY_FIPS  : chr  "081" "047" "047" "047" ...
##  $ URL       : chr  "http://www.usps.com/" "http://www.usps.com/" "http://www.usps.com/" "http://www.usps.com/" ...
##  $ SHAPE_AREA: num  0 0 0 0 0 0 0 0 0 0 ...
##  $ SHAPE_LEN : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ geometry  :sfc_POLYGON of length 263; first list element: List of 1
##   ..$ : num [1:159, 1:2] 1038098 1038142 1038171 1038280 1038521 ...
##   ..- attr(*, "class")= chr [1:3] "XY" "POLYGON" "sfg"
##  - attr(*, "sf_column")= chr "geometry"
##  - attr(*, "agr")= Factor w/ 3 levels "constant","aggregate",..: NA NA NA NA NA NA NA NA NA NA ...
##   ..- attr(*, "names")= chr [1:12] "ZIPCODE" "BLDGZIP" "PO_NAME" "POPULATION" ...
#plotting the postcode shapefile, pure geometry
plot(st_geometry(nyc_sf), main='Pure geometry with st geometry function')

#plotting only the zipcode column
plot(nyc_sf['ZIPCODE'], main='One column with ["ZIPCODE"]')

#two columns, zipcode and county
plot(nyc_sf[c('ZIPCODE', 'COUNTY')], main='Two Columns with ["ZIPCODE", "COUNTY"]')

## Task 3: Reading the NYS health facilities spreadsheet data (lat and long data)

nys_health_df <- read_csv('DATA_Week7/NYS_Health_Facility.csv', 
                          show_col_types = FALSE,
                          lazy = FALSE)

#replacing all NA values in nys_health_df with 0 to avoid NA error in the sf line
nys_health_dfT <- as.data.frame(nys_health_df)
nys_health_dfT[is.na(nys_health_dfT)] <- 0

str(nys_health_dfT)
## 'data.frame':    3990 obs. of  36 variables:
##  $ Facility ID                 : num  204 620 654 1156 2589 ...
##  $ Facility Name               : chr  "Hospice at Lourdes" "Charles T Sitrin Health Care Center Inc" "Central Park Rehabilitation and Nursing Center" "East Side Nursing Home" ...
##  $ Short Description           : chr  "HSPC" "NH" "NH" "NH" ...
##  $ Description                 : chr  "Hospice" "Residential Health Care Facility - SNF" "Residential Health Care Facility - SNF" "Residential Health Care Facility - SNF" ...
##  $ Facility Open Date          : chr  "06/01/1985" "02/01/1989" "02/01/1989" "08/01/1979" ...
##  $ Facility Address 1          : chr  "4102 Old Vestal Road" "2050 Tilden Avenue" "116 Martin Luther King East" "62 Prospect St" ...
##  $ Facility Address 2          : chr  "0" "0" "0" "0" ...
##  $ Facility City               : chr  "Vestal" "New Hartford" "Syracuse" "Warsaw" ...
##  $ Facility State              : chr  "New York" "New York" "New York" "New York" ...
##  $ Facility Zip Code           : chr  "13850" "13413" "13205" "14569" ...
##  $ Facility Phone Number       : num  6.08e+09 3.16e+09 3.15e+09 5.86e+09 5.86e+09 ...
##  $ Facility Fax Number         : num  0 0 0 0 0 ...
##  $ Facility Website            : chr  "0" "0" "0" "0" ...
##  $ Facility County Code        : num  3 32 33 60 2 ...
##  $ Facility County             : chr  "Broome" "Oneida" "Onondaga" "Wyoming" ...
##  $ Regional Office ID          : num  3 3 3 1 1 1 7 1 7 5 ...
##  $ Regional Office             : chr  "Central New York Regional Office" "Central New York Regional Office" "Central New York Regional Office" "Western Regional Office - Buffalo" ...
##  $ Main Site Name              : chr  "0" "0" "0" "0" ...
##  $ Main Site Facility ID       : num  0 0 0 0 0 ...
##  $ Operating Certificate Number: chr  "0301501F" "3227304N" "3301326N" "6027303N" ...
##  $ Operator Name               : chr  "Our Lady of Lourdes Memorial Hospital Inc" "Charles T Sitrin Health Care Center, Inc" "CPRNC, LLC" "East Side Nursing Home Inc" ...
##  $ Operator Address 1          : chr  "169 Riverside Drive" "Box 1000 Tilden Avenue" "116 Martin Luther King East" "62 Prospect Street" ...
##  $ Operator Address 2          : chr  "0" "0" "0" "0" ...
##  $ Operator City               : chr  "Binghamton" "New Hartford" "Syracuse" "Warsaw" ...
##  $ Operator State              : chr  "New York" "New York" "New York" "New York" ...
##  $ Operator Zip Code           : chr  "13905" "13413" "13205" "14569" ...
##  $ Cooperator Name             : chr  "0" "0" "0" "0" ...
##  $ Cooperator Address          : chr  "0" "0" "0" "0" ...
##  $ Cooperator Address 2        : chr  "0" "0" "0" "0" ...
##  $ Cooperator City             : chr  "0" "0" "0" "0" ...
##  $ Cooperator State            : chr  "New York" "New York" "New York" "New York" ...
##  $ Cooperator Zip Code         : chr  "0" "0" "0" "0" ...
##  $ Ownership Type              : chr  "Not for Profit Corporation" "Not for Profit Corporation" "LLC" "Business Corporation" ...
##  $ Facility Latitude           : num  42.1 43.1 0 42.7 42.1 ...
##  $ Facility Longitude          : num  -76 -75.2 0 -78.1 -78 ...
##  $ Facility Location           : chr  "(42.097095, -75.975243)" "(43.05497, -75.228828)" "0" "(42.738979, -78.12867)" ...
#turning the data into a shapefile
nys_health_sf <- st_as_sf(nys_health_dfT, 
                          coords = c("Facility Longitude", "Facility Latitude"))
str(nys_health_sf)
## Classes 'sf' and 'data.frame':   3990 obs. of  35 variables:
##  $ Facility ID                 : num  204 620 654 1156 2589 ...
##  $ Facility Name               : chr  "Hospice at Lourdes" "Charles T Sitrin Health Care Center Inc" "Central Park Rehabilitation and Nursing Center" "East Side Nursing Home" ...
##  $ Short Description           : chr  "HSPC" "NH" "NH" "NH" ...
##  $ Description                 : chr  "Hospice" "Residential Health Care Facility - SNF" "Residential Health Care Facility - SNF" "Residential Health Care Facility - SNF" ...
##  $ Facility Open Date          : chr  "06/01/1985" "02/01/1989" "02/01/1989" "08/01/1979" ...
##  $ Facility Address 1          : chr  "4102 Old Vestal Road" "2050 Tilden Avenue" "116 Martin Luther King East" "62 Prospect St" ...
##  $ Facility Address 2          : chr  "0" "0" "0" "0" ...
##  $ Facility City               : chr  "Vestal" "New Hartford" "Syracuse" "Warsaw" ...
##  $ Facility State              : chr  "New York" "New York" "New York" "New York" ...
##  $ Facility Zip Code           : chr  "13850" "13413" "13205" "14569" ...
##  $ Facility Phone Number       : num  6.08e+09 3.16e+09 3.15e+09 5.86e+09 5.86e+09 ...
##  $ Facility Fax Number         : num  0 0 0 0 0 ...
##  $ Facility Website            : chr  "0" "0" "0" "0" ...
##  $ Facility County Code        : num  3 32 33 60 2 ...
##  $ Facility County             : chr  "Broome" "Oneida" "Onondaga" "Wyoming" ...
##  $ Regional Office ID          : num  3 3 3 1 1 1 7 1 7 5 ...
##  $ Regional Office             : chr  "Central New York Regional Office" "Central New York Regional Office" "Central New York Regional Office" "Western Regional Office - Buffalo" ...
##  $ Main Site Name              : chr  "0" "0" "0" "0" ...
##  $ Main Site Facility ID       : num  0 0 0 0 0 ...
##  $ Operating Certificate Number: chr  "0301501F" "3227304N" "3301326N" "6027303N" ...
##  $ Operator Name               : chr  "Our Lady of Lourdes Memorial Hospital Inc" "Charles T Sitrin Health Care Center, Inc" "CPRNC, LLC" "East Side Nursing Home Inc" ...
##  $ Operator Address 1          : chr  "169 Riverside Drive" "Box 1000 Tilden Avenue" "116 Martin Luther King East" "62 Prospect Street" ...
##  $ Operator Address 2          : chr  "0" "0" "0" "0" ...
##  $ Operator City               : chr  "Binghamton" "New Hartford" "Syracuse" "Warsaw" ...
##  $ Operator State              : chr  "New York" "New York" "New York" "New York" ...
##  $ Operator Zip Code           : chr  "13905" "13413" "13205" "14569" ...
##  $ Cooperator Name             : chr  "0" "0" "0" "0" ...
##  $ Cooperator Address          : chr  "0" "0" "0" "0" ...
##  $ Cooperator Address 2        : chr  "0" "0" "0" "0" ...
##  $ Cooperator City             : chr  "0" "0" "0" "0" ...
##  $ Cooperator State            : chr  "New York" "New York" "New York" "New York" ...
##  $ Cooperator Zip Code         : chr  "0" "0" "0" "0" ...
##  $ Ownership Type              : chr  "Not for Profit Corporation" "Not for Profit Corporation" "LLC" "Business Corporation" ...
##  $ Facility Location           : chr  "(42.097095, -75.975243)" "(43.05497, -75.228828)" "0" "(42.738979, -78.12867)" ...
##  $ geometry                    :sfc_POINT of length 3990; first list element:  'XY' num  -76 42.1
##  - attr(*, "sf_column")= chr "geometry"
##  - attr(*, "agr")= Factor w/ 3 levels "constant","aggregate",..: NA NA NA NA NA NA NA NA NA NA ...
##   ..- attr(*, "names")= chr [1:34] "Facility ID" "Facility Name" "Short Description" "Description" ...
#assigning WGS84 projection
st_crs(nys_health_sf) <- 4326
st_crs(nys_health_sf)
## Coordinate Reference System:
##   User input: EPSG:4326 
##   wkt:
## GEOGCRS["WGS 84",
##     ENSEMBLE["World Geodetic System 1984 ensemble",
##         MEMBER["World Geodetic System 1984 (Transit)"],
##         MEMBER["World Geodetic System 1984 (G730)"],
##         MEMBER["World Geodetic System 1984 (G873)"],
##         MEMBER["World Geodetic System 1984 (G1150)"],
##         MEMBER["World Geodetic System 1984 (G1674)"],
##         MEMBER["World Geodetic System 1984 (G1762)"],
##         MEMBER["World Geodetic System 1984 (G2139)"],
##         MEMBER["World Geodetic System 1984 (G2296)"],
##         ELLIPSOID["WGS 84",6378137,298.257223563,
##             LENGTHUNIT["metre",1]],
##         ENSEMBLEACCURACY[2.0]],
##     PRIMEM["Greenwich",0,
##         ANGLEUNIT["degree",0.0174532925199433]],
##     CS[ellipsoidal,2],
##         AXIS["geodetic latitude (Lat)",north,
##             ORDER[1],
##             ANGLEUNIT["degree",0.0174532925199433]],
##         AXIS["geodetic longitude (Lon)",east,
##             ORDER[2],
##             ANGLEUNIT["degree",0.0174532925199433]],
##     USAGE[
##         SCOPE["Horizontal component of 3D system."],
##         AREA["World."],
##         BBOX[-90,-180,90,180]],
##     ID["EPSG",4326]]
##Task 4: Reading the NYS retail food stores data w/ NYC projection

nys_ret_df <- read_csv('DATA_Week7/nys_retail_food_store_xy.csv', 
                          show_col_types = FALSE,
                          lazy = FALSE)

#replacing all NA values in nys_ret_df with 0 to avoid NA error in the sf line
nys_ret_dfT <- as.data.frame(nys_ret_df)
nys_ret_dfT[is.na(nys_ret_dfT)] <- 0

str(nys_ret_dfT)
## 'data.frame':    29389 obs. of  18 variables:
##  $ County            : chr  "Albany" "Albany" "Albany" "Albany" ...
##  $ License.Number    : num  733149 704590 727909 720557 15890 ...
##  $ Operation.Type    : chr  "Store" "Store" "Store" "Store" ...
##  $ Establishment.Type: chr  "A" "JAC" "JAC" "JAC" ...
##  $ Entity.Name       : chr  "SPEEDWAY LLC" "1250 SELKIRK INC" "RED-KAP SALES INC" "SAEED SADIQ, SAIKA NOREEN" ...
##  $ DBA.Name          : chr  "12110" "1250 SELKIRK" "1667 GENERAL STORE" "19 STREET QUICK STOP" ...
##  $ Street.Number     : chr  "719" "1250" "1667" "315" ...
##  $ Street.Name       : chr  "NEW LOUDON RD" "RTE 9W & 396" "WESTERN AVENUE" "19TH STREET" ...
##  $ Address.Line.2    : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ Address.Line.3    : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ City              : chr  "LATHAM" "SELKIRK" "ALBANY" "WATERVLIET" ...
##  $ State             : chr  "NY" "NY" "NY" "NY" ...
##  $ Zip.Code          : num  12110 12158 12203 12189 12210 ...
##  $ Square.Footage    : num  300 3000 2000 1200 1800 0 0 200 0 2000 ...
##  $ Location          : chr  "719 NEW LOUDON RD\r\nLATHAM, NY 12110\r\n(42.739618, -73.761949)" "1250 RTE 9 W\r\nSELKIRK, NY 12158\r\n(42.547591, -73.8073)" "1667 WESTERN AVENUE\r\nALBANY, NY 12203\r\n(42.686553, -73.854665)" "315 19TH STREET\r\nWATERVLIET, NY 12189\r\n(42.73063, -73.703443)" ...
##  $ Coords            : chr  "42.739618, -73.761949" "42.547591, -73.8073" "42.686553, -73.854665" "42.73063, -73.703443" ...
##  $ Y                 : num  42.7 42.5 42.7 42.7 42.7 ...
##  $ X                 : num  -73.8 -73.8 -73.9 -73.7 -73.8 ...
#turning the data into a shapefile
nys_ret_sf <- st_as_sf(nys_ret_dfT, 
                          coords = c("X", "Y"))
str(nys_ret_sf)
## Classes 'sf' and 'data.frame':   29389 obs. of  17 variables:
##  $ County            : chr  "Albany" "Albany" "Albany" "Albany" ...
##  $ License.Number    : num  733149 704590 727909 720557 15890 ...
##  $ Operation.Type    : chr  "Store" "Store" "Store" "Store" ...
##  $ Establishment.Type: chr  "A" "JAC" "JAC" "JAC" ...
##  $ Entity.Name       : chr  "SPEEDWAY LLC" "1250 SELKIRK INC" "RED-KAP SALES INC" "SAEED SADIQ, SAIKA NOREEN" ...
##  $ DBA.Name          : chr  "12110" "1250 SELKIRK" "1667 GENERAL STORE" "19 STREET QUICK STOP" ...
##  $ Street.Number     : chr  "719" "1250" "1667" "315" ...
##  $ Street.Name       : chr  "NEW LOUDON RD" "RTE 9W & 396" "WESTERN AVENUE" "19TH STREET" ...
##  $ Address.Line.2    : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ Address.Line.3    : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ City              : chr  "LATHAM" "SELKIRK" "ALBANY" "WATERVLIET" ...
##  $ State             : chr  "NY" "NY" "NY" "NY" ...
##  $ Zip.Code          : num  12110 12158 12203 12189 12210 ...
##  $ Square.Footage    : num  300 3000 2000 1200 1800 0 0 200 0 2000 ...
##  $ Location          : chr  "719 NEW LOUDON RD\r\nLATHAM, NY 12110\r\n(42.739618, -73.761949)" "1250 RTE 9 W\r\nSELKIRK, NY 12158\r\n(42.547591, -73.8073)" "1667 WESTERN AVENUE\r\nALBANY, NY 12203\r\n(42.686553, -73.854665)" "315 19TH STREET\r\nWATERVLIET, NY 12189\r\n(42.73063, -73.703443)" ...
##  $ Coords            : chr  "42.739618, -73.761949" "42.547591, -73.8073" "42.686553, -73.854665" "42.73063, -73.703443" ...
##  $ geometry          :sfc_POINT of length 29389; first list element:  'XY' num  -73.8 42.7
##  - attr(*, "sf_column")= chr "geometry"
##  - attr(*, "agr")= Factor w/ 3 levels "constant","aggregate",..: NA NA NA NA NA NA NA NA NA NA ...
##   ..- attr(*, "names")= chr [1:16] "County" "License.Number" "Operation.Type" "Establishment.Type" ...
#assigning WGS84 projection
st_crs(nys_ret_sf) <- 4326
st_crs(nys_ret_sf)
## Coordinate Reference System:
##   User input: EPSG:4326 
##   wkt:
## GEOGCRS["WGS 84",
##     ENSEMBLE["World Geodetic System 1984 ensemble",
##         MEMBER["World Geodetic System 1984 (Transit)"],
##         MEMBER["World Geodetic System 1984 (G730)"],
##         MEMBER["World Geodetic System 1984 (G873)"],
##         MEMBER["World Geodetic System 1984 (G1150)"],
##         MEMBER["World Geodetic System 1984 (G1674)"],
##         MEMBER["World Geodetic System 1984 (G1762)"],
##         MEMBER["World Geodetic System 1984 (G2139)"],
##         MEMBER["World Geodetic System 1984 (G2296)"],
##         ELLIPSOID["WGS 84",6378137,298.257223563,
##             LENGTHUNIT["metre",1]],
##         ENSEMBLEACCURACY[2.0]],
##     PRIMEM["Greenwich",0,
##         ANGLEUNIT["degree",0.0174532925199433]],
##     CS[ellipsoidal,2],
##         AXIS["geodetic latitude (Lat)",north,
##             ORDER[1],
##             ANGLEUNIT["degree",0.0174532925199433]],
##         AXIS["geodetic longitude (Lon)",east,
##             ORDER[2],
##             ANGLEUNIT["degree",0.0174532925199433]],
##     USAGE[
##         SCOPE["Horizontal component of 3D system."],
##         AREA["World."],
##         BBOX[-90,-180,90,180]],
##     ID["EPSG",4326]]
#reprojecting to SPCS Long Island 2831
nys_ret_2831 <- st_transform(nys_ret_sf, 2831)
st_crs(nys_ret_2831)
## Coordinate Reference System:
##   User input: EPSG:2831 
##   wkt:
## PROJCRS["NAD83(HARN) / New York Long Island",
##     BASEGEOGCRS["NAD83(HARN)",
##         DATUM["NAD83 (High Accuracy Reference Network)",
##             ELLIPSOID["GRS 1980",6378137,298.257222101,
##                 LENGTHUNIT["metre",1]]],
##         PRIMEM["Greenwich",0,
##             ANGLEUNIT["degree",0.0174532925199433]],
##         ID["EPSG",4152]],
##     CONVERSION["SPCS83 New York Long Island zone (meter)",
##         METHOD["Lambert Conic Conformal (2SP)",
##             ID["EPSG",9802]],
##         PARAMETER["Latitude of false origin",40.1666666666667,
##             ANGLEUNIT["degree",0.0174532925199433],
##             ID["EPSG",8821]],
##         PARAMETER["Longitude of false origin",-74,
##             ANGLEUNIT["degree",0.0174532925199433],
##             ID["EPSG",8822]],
##         PARAMETER["Latitude of 1st standard parallel",41.0333333333333,
##             ANGLEUNIT["degree",0.0174532925199433],
##             ID["EPSG",8823]],
##         PARAMETER["Latitude of 2nd standard parallel",40.6666666666667,
##             ANGLEUNIT["degree",0.0174532925199433],
##             ID["EPSG",8824]],
##         PARAMETER["Easting at false origin",300000,
##             LENGTHUNIT["metre",1],
##             ID["EPSG",8826]],
##         PARAMETER["Northing at false origin",0,
##             LENGTHUNIT["metre",1],
##             ID["EPSG",8827]]],
##     CS[Cartesian,2],
##         AXIS["easting (X)",east,
##             ORDER[1],
##             LENGTHUNIT["metre",1]],
##         AXIS["northing (Y)",north,
##             ORDER[2],
##             LENGTHUNIT["metre",1]],
##     USAGE[
##         SCOPE["Engineering survey, topographic mapping."],
##         AREA["United States (USA) - New York - counties of Bronx; Kings; Nassau; New York; Queens; Richmond; Suffolk."],
##         BBOX[40.47,-74.26,41.3,-71.8]],
##     ID["EPSG",2831]]
##Task 5: Using mapview to verify the datasets' geometry locations

#Mapping the data from Task 2 
nyc_sf %>% dplyr::select(ZIPCODE, COUNTY, PO_NAME, AREA) %>%
  mapview::mapview()
#Mapping the data from Task 3 
nys_health_sf %>% dplyr::select(Description, geometry) %>%
  mapview::mapview()
#Mapping the data from Task 4
nys_ret_sf %>% dplyr::select(County, City, State) %>%
  mapview::mapview()
#Task 6: Saving all sf files 

#Data from task 2 
save(nyc_sf, file = './DATA_WEEK7/nyc_sf.RData')
st_write(nyc_sf, 
         dsn = './DATA_WEEK7/nyc_sf.gpkg', 
         layer='nyc_postal_codes',
         delete_layer = TRUE)
## Deleting layer `nyc_postal_codes' using driver `GPKG'
## Writing layer `nyc_postal_codes' to data source `./DATA_WEEK7/nyc_sf.gpkg' using driver `GPKG'
## Writing 263 features with 12 fields and geometry type Polygon.
#Data from task 3
save(nys_health_sf, file = './DATA_WEEK7/nys_health_sf.RData')
st_write(nys_health_sf, 
         dsn = './DATA_WEEK7/nys_health_sf.gpkg', 
         layer='nys_health',
         delete_layer = TRUE)
## Deleting layer `nys_health' using driver `GPKG'
## Writing layer `nys_health' to data source `./DATA_WEEK7/nys_health_sf.gpkg' using driver `GPKG'
## Writing 3990 features with 34 fields and geometry type Point.
#Data from task 4
save(nys_ret_sf, file = './DATA_WEEK7/nys_ret_sf.RData')
st_write(nys_ret_sf, 
         dsn = './DATA_WEEK7/nys_ret_sf.gpkg', 
         layer='nys_ret',
         delete_layer = TRUE)
## Deleting layer `nys_ret' using driver `GPKG'
## Writing layer `nys_ret' to data source `./DATA_WEEK7/nys_ret_sf.gpkg' using driver `GPKG'
## Writing 29389 features with 16 fields and geometry type Point.