I have one sf object with US counties, and another with US congressional districts. I need to know (i) which counties are in which congressional district, and (ii) if one county overlaps the district boundary (i.e. is contained within two districts) then I need to know which district it's in "more", or what proportion of the county lays in each.
Here are my exact sf objects:
library(USAboundaries)
library(sf)
union_states <- c("Maine", "New Hampshire", "Vermont", "New York", "Massachusetts", "Rhode Island", "Connecticut", "Pennsylvania", "New Jersey", "Ohio", "Indiana", "Illinois", "Iowa", "Wisconsin", "Minnesota", "Michigan") # only core states: exluces CA, WA, KS, and boundary states
union_sf <- us_counties(map_date = "1865-01-01", states = union_states, resolution = 'high')
union_congress_sf <- us_congressional(resolution = "low", states = union_states)
This question poses my exact question, but is a bit outdated and doesn't work with sf objects: Using R intersections to create a polygons-inside-a-polygon key using two shapefile layers