I am trying to assign a region ID to each record within a point shapefile. Each point would be assigned the Region ID of the region it falls within. The point feature is called "deciles" and the region/polygon feature is "regions". I keep getting this error:
Error in UseMethod("inner_join") : no applicable method for 'inner_join' applied to an object of class "c('SpatialPointsDataFrame', 'SpatialPoints', 'Spatial')"
require(rgdal) library(dplyr) library(sf) deciles<- readOGR("C:\\filepath", "deciles") regions<- readOGR("C:\\filepath", "regions") #Assign each bsu to a region with a spatial join bsu_regions_join <- inner_join(deciles, regions, by = region_ID)
I've also tried these variants and I still get the same error:
bsu_regions_join <- st_join(deciles, left = FALSE, regions["region_ID"]) bsu_regions_join <- st_join(deciles, left = FALSE, regions) bsu_regions_join <- st_join(regions, deciles, left = FALSE)