Learn R Programming

eiCompare (version 3.0.4)

check_diffs: Internal function that checks for adequate closeness between sums of race/candidate columns and provided vote totals.

Description

This function checks conditions inputted to clean_race by the user

Usage

check_diffs(vote_sums, provided_totals, max_dev = 0.1, avg_dev = 0.25)

Value

A list containing two objects, 'closeness' and 'deviates'. See details for more information.

Arguments

vote_sums

A numeric vector containing the sums of votes by each race/ethnicity

provided_totals

A numeric vector containing the totals provided to the clean_race function

max_dev

A floating point object passed from clean_race

avg_dev

A floating point object passed from clean_race

Author

Ari Decter-Frain

Details

When this function returns 0, votes do not sum close enough to the provided vote totals.

When this function returns 1, votes sum marginally away from the provided totals. Restandardization is appropriate

When this function returns 2, votes sum exactly to vote totals