Read a DRA block assignment export and attach it to 2020 census blocks, optionally collapsing the assignments to a precinct layer.
dra2r(dra, state, precincts, epsg = 3857)Path to a DRA CSV export, or a dataframe containing columns
GEOID20 and District.
State postal abbreviation used to fetch 2020 blocks.
Optional sf object of precinct shapes. If supplied, the
function assigns each precinct the most common block-level district among
the blocks matched to it.
numeric EPSG code to planarize to. Default is 3857.
sf object at the block level when precincts is omitted, or at the
precinct level when precincts is supplied.
if (FALSE) { # \dontrun{
# Needs Census Bureau API
# dra_utah_test is available at https://bit.ly/3c6UDKk
blocklevel <- dra2r('dra_utah_test.csv', state = 'UT')
} # }