This is achieved by determining the units (e.g., Census block, district, etc.) for which each voter's address lies within.
merge_voter_file_to_shape(
voter_file,
shape_file,
crs = NULL,
coords = c("lon", "lat"),
voter_id = "voter_id"
)
A dataframe denoting the voter file. If it is not a geometry dataframe, it will be converted to one.
The shapefile for the region, as an sf object.
The PROJ4 string or int for the coordinate reference system.
The columns, as a list, that refer to the longitude and latitude.
The column for the Voter ID.
The voter file with unit information attached.
This function assumes that the sf package was used to read in the shape files.