dedupe_precincts: Remove or identify duplicated precincts

View source: R/ei_preprocessing.R

dedupe_precinctsR Documentation

Remove or identify duplicated precincts

Description

Removes any rows in the dataset that are fully duplicated. If necessary, adds ' duplicates' column indicating where precincts appear duplicated, for manual inspection by the user

Usage

dedupe_precincts(data, id_cols, verbose = TRUE)

Arguments

data

A data.frame() object containing precinct-level turnout data by race and candidate

id_cols

The name or index of the column in the data containing unique precinct identifiers. Can pass multiple column names or indices in a vector if precincts are identified over multiple columns (eg. c("precinctid", "countyid")).

verbose

A boolean. If true, messages are returned describing actions taken by the function.

Value

A new dataframe without duplicated rows, and (if any) a boolean column identifying duplicated precincts for further investigation.

Author(s)

Ari Decter-Frain <agd75@cornell.edu>


eiCompare documentation built on Aug. 31, 2023, 5:16 p.m.