I am trying to find which City Council districts represent which zip codes in NYC by using the sf library and leaflet. I have spatial polygons for both council districts and zip codes. My problem is that whenever I try to find the intersection between the polygons, I get extra zip codes that have overlapping borders with the district borders. There is no portion of the district that falls into those zip codes beyond the border, but using a spatial intersection includes those bordering zip codes.
Is there a spatial manipulation function that would return just the intersection of the polygons without the places where the polygons only share a border?
Here is a visual of my issue (see the overlapping border of zip code (in grey) and council district (in black):
And my code:
library(sf)
#NYC Zip Codes
nyc_zips <- read_sf('ZIP_CODE_040114.shp')
#Left joining zip code boundaries with total count of drivers in each zip
ny_zips_drivers <- left_join(nyc_zips, driver_zips, by = 'ZIPCODE')
#City Council
cc_shp <- read_sf('nycc_22a/nycc.shp')
#Spatial Intersection of council districts and zip codes
cc_intersection <- st_intersection(x = cc_shp, y = ny_zips_drivers)