Code
smpCode <- "hello, R markdown and RPubs!"
cat(smpCode)hello, R markdown and RPubs!
smpCode <- "hello, R markdown and RPubs!"
cat(smpCode)hello, R markdown and RPubs!
zip_codes <- st_read('R-Spatial_I_Lab/ZIP_CODE_040114/ZIP_CODE_040114.shp')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)
health_facilities <- read.csv('R-Spatial_I_Lab/NYS_Health_Facility 3(in).csv')
hf_df <- 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_sf <- st_as_sf(hf_df, coords = c("Facility.Longitude", "Facility.Latitude"))
plot(hf_sf, main='Health Facilities Data')Warning: plotting the first 9 out of 34 attributes; use max.plot = 34 to plot
all
retail_df <- read.csv('R-Spatial_I_Lab/NYS_Retail_Food_Stores.csv')
retail_df_xy <- read.csv('R-Spatial_I_Lab/nys_retail_food_store_xy.csv')
r_sf <- 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"))
#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
one_zip <- zip_codes %>%
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.
brooklyn_hf <- hf_sf %>%
filter( Facility.County== 'Kings')
#mapview() + mapview(brooklyn_hf)Retail Stores in zip code 11421
r_sf_filt <- r_sf %>%
filter(Zip.Code == '11421')
mapview() + mapview(r_sf_filt)# Now a geopackage
save(r_sf, hf_sf, zip_codes,
file = 'lab7.RData')