get_precinct: Extract precinct-identifying information

View source: R/read_SC.R

get_precinctR Documentation

Extract precinct-identifying information

Description

Get a precinct-level dataset by using dplyr::distinct(.keep_all = TRUE). Thus the rows need to be ordered correctly.

Usage

get_precinct(df, precinct_regex = "(RUN DATE|ELECTION ID:)")

Arguments

df

a EL155 dataset, read through read_EL155

precinct_regex

regex to identify rows with precinct names. For 2018-11-06, use "PRECINCT (?!TOTAL)". Default should work in ohter cases.

Value

A dataset keyed by precinct. start_id and end_id refer to the range of the precinct in terms of the row IDs in read_EL155 output. column 'precinct' is is the name portion of the precinct header. 'precinct_id' is the ID of precinct within the county

Examples

data(G2016_Dillon_EL155)
dillon_p <- get_precinct(G2016_Dillon_EL155)
wprecinct <- add_precinct(G2016_Dillon_EL155, dillon_p)


kuriwaki/ballot documentation built on May 1, 2023, 9:55 p.m.