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)
Required. an sf dataframe of precinct shapes
Required. Either a vector of district assignments or the name of a column in precincts with district assignments.
Required. the state postal code of the state
Optional. A path to try to save to. Warns if saving failed.
numeric EPSG code to planarize to. Default is 3857.
tibble with columns Id, as used by DRA, identical to GEOID in census terms and District.
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')
}