Geographic Information Systems Asked by puredata on October 27, 2020
I have three spatial layers, 1 USA boundaries and 2 point layers for Arby’s and Hardee’s locations across USA. Goal of the assignment is to create 2 choropleth maps for density of these fast food joints shown by state.
What I am able to achieve so far;
#importing layers
usa <- read_sf("/Users/username/Desktop/r-intro/data/seminarClass/usa.shp")
arbys <- sf::st_read("/Users/username/Desktop/r-intro/data/seminarClass/restaurants.gdb", layer="arbys")
hardees <- sf::st_read("/Users/username/Desktop/r-intro/data/seminarClass/restaurants.gdb", layer="hardees")
#crs check
usacrs <- st_crs(usa) # "ESRI",102003
usacrs
arbyscrs <- st_crs(arbys) # "EPSG",4269
hardeescrs <- st_crs(hardees) # "EPSG",4269
usageom <- (usa$geometry) #usa geometry
#crs matching
arbys_usa <- arbys %>% st_set_crs(st_crs(usa))
st_crs(arbys_usa)
hardees_usa <- hardees %>% st_set_crs(st_crs(usa))
st_crs(hardees_usa)
# spatial join - THIS IS WHERE I AM HAVING TROUBLE
arbyJoin <- usa %>% st_join(arbys_usa) %>% group_by(STATE_FIPS) %>%
summarise(...)
hardeeJoin <- usa %>% st_join(hardees_usa) %>% group_by(STATE_FIPS) %>%
summarise(...)
All coding except the part in spatial join is done by me and I understand what’s going on in the code. I emailed my instructor in order to ask for help and he send me this line shown in the spatial join section of my code;
arbyJoin <- usa %>% st_join(arbys_usa) %>% group_by(STATE_FIPS) %>%
summarise(...)
I don’t understand exactly what’s going on in this part therefore I can’t figure out what to do with the summarise part.
I have tried
summarise(arbyJoin, sum=(STATE_NAME))
and
summarise(arbyJoin, sum=(geometry))
I don’t necessarily get an error but I don’t understand if they work or not as well, since I don’t understand the code.
Can anyone shed some light on this line of the code and point me the right direction on how to proceed with this summarise function?
Ultimate result I’m trying to achieve is to create a choropleth map using these joint layers.
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP