eiCompare (version 3.0.0)

resolve_missing_vals: Remove / Impute NAs in an EI dataset

Description

Remove / Impute NAs in an EI dataset

Usage

resolve_missing_vals(
  data,
  cand_cols,
  race_cols,
  totals_col,
  na_action = "DROP",
  verbose = TRUE
)

Arguments

data

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

cand_cols

A character vector listing the column names for turnout for each candidate

race_cols

A character vector listing the column names for turnout by race

totals_col

The name of the column containing total votes cast in each precinct

na_action

A string indicating how to handle missing values in EI columns. Possible values are "DROP" and "MEAN". "DROP" drops all rows where variables are missing. "MEAN" imputes missing values as the mean of the column

verbose

A boolean indicating whether to give status updates