Match Across Geographic Layers

geo_match(from, to, method = "center", tiebreaker = TRUE)

Arguments

from

smaller geographic level to match up from

to

larger geographic level to be matched to

method

string from center, centroid, point, or area for matching method

tiebreaker

Should ties be broken? boolean. If FALSE, precincts with no matches get value -1 and precincts with multiple matches get value -2.

Value

Integer Vector of matches length(to) with values in 1:nrow(from)

Examples

if (FALSE) { data(checkerboard) counties <- st_as_sf(as.data.frame(rbind(st_union(checkerboard %>% filter(i < 4)), st_union(checkerboard %>% filter(i >= 4)) ))) geo_match(from = checkerboard, to = counties) }