Project a plan at the precinct level down to blocks into a format that can be used with DRA. Projecting down to blocks can take a lot of time for larger states.

r2dra(precincts, plan, state, path, epsg = 3857)

Arguments

precincts

Required. an sf dataframe of precinct shapes

plan

Required. Either a vector of district assignments or the name of a column in precincts with district assignments.

state

Required. the state postal code of the state

path

Optional. A path to try to save to. Warns if saving failed.

epsg

numeric EPSG code to planarize to. Default is 3857.

Value

tibble with columns Id, as used by DRA, identical to GEOID in census terms and District.

Examples

if (FALSE) {
# Needs Census Bureau API
cd <- tinytiger::tt_congressional_districts() |> filter(STATEFP == '49')
cnty <- tinytiger::tt_counties(state = 49)
matchedcty <- geo_match(from = cnty, to = cd)
# use counties as precincts and let the plan be their center match:
r2dra(cnty, matchedcty, 'UT', 'r2dra_ex.csv')
}