I'm trying to join a data frame with a shapefile using R. My shapefile has 7 features, corresponding to 7 regions of my city.
My data.frame has reptile data in 6 regions of my city, but in one region no reptiles were found.
I'm using the sp::merge command to join the shapefile and data.frame, but when I do the union, the region that doesn't have a reptile doesn't appear.
#load data.frame
serpentes<-read_excel('E:/22-serpentes_cg/R/serpentes_cg_bioterio_ucdb_final.xlsx')
#View(serpentes)#calc data
#Total de Serpente
total_serpentes<-serpentes_cg%>%
group_by(regiao_cg)%>%
summarise(Total=sum(quant))
View(total_serpentes)#load shapefile
regiao<-sf::st_read("E:/22-serpentes_cg/geo/regioes_urbanas.shp")%>%
rename(regiao_cg=REGIAO_CG)
View(regiao)#join shp and data.frame
total_especies_shp<-sp::merge(regiao, total_especies, by="regiao_cg")
output file