Code
<- "hello, R markdown and RPubs!"
smpCode
cat(smpCode)
hello, R markdown and RPubs!
<- "hello, R markdown and RPubs!"
smpCode
cat(smpCode)
hello, R markdown and RPubs!
<- st_read('R-Spatial_I_Lab/ZIP_CODE_040114/ZIP_CODE_040114.shp') zip_codes
Reading layer `ZIP_CODE_040114' from data source
`C:\Users\wcornejo\Documents\assign7\assign7\R-Spatial_I_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)
<- read.csv('R-Spatial_I_Lab/NYS_Health_Facility 3(in).csv')
health_facilities <- health_facilities[!is.na(health_facilities$Facility.Longitude), ]
hf_df <- hf_df[!is.na(hf_df$Facility.Latitude), ]
hf_df <- hf_df[!is.na(hf_df$Facility.Longitude), ]
hf_df <- hf_df[hf_df$Facility.Latitude != 0, ]
hf_df <- hf_df[hf_df$Facility.Longitude != 0, ]
hf_df <- st_as_sf(hf_df, coords = c("Facility.Longitude", "Facility.Latitude"))
hf_sf plot(hf_sf, main='Health Facilities Data')
Warning: plotting the first 9 out of 34 attributes; use max.plot = 34 to plot
all
<- read.csv('R-Spatial_I_Lab/NYS_Retail_Food_Stores.csv')
retail_df <- read.csv('R-Spatial_I_Lab/nys_retail_food_store_xy.csv')
retail_df_xy <- retail_df_xy[!is.na(retail_df_xy$X),]
r_sf <- r_sf[!is.na(r_sf$Y),]
r_sf <- st_as_sf(r_sf, coords = c("X", "Y"))
r_sf #had to save with encoding utf-8 in vscode
plot(r_sf, main = 'Retail Food Stores in NYS Data')
Warning: plotting the first 9 out of 16 attributes; use max.plot = 16 to plot
all
Warning in min(x): no non-missing arguments to min; returning Inf
Warning in max(x): no non-missing arguments to max; returning -Inf
One zip code
<- zip_codes %>%
one_zip filter(ZIPCODE == '11421')
mapview(one_zip)
Health Facilities in King’s County
The mapview does not format correctly so i took a screenshot of the render, which worked fine. It’s just the publish that doesn’t work.
<- hf_sf %>%
brooklyn_hf filter( Facility.County== 'Kings')
#mapview() + mapview(brooklyn_hf)
Retail Stores in zip code 11421
<- r_sf %>%
r_sf_filt filter(Zip.Code == '11421')
mapview() + mapview(r_sf_filt)
# Now a geopackage
save(r_sf, hf_sf, zip_codes,
file = 'lab7.RData')