eiCompare (version 3.0.0)

performance_analysis: Performs a performance analysis using a voter file, census shape, and district shape.

Description

Performs a performance analysis using a voter file, census shape, and district shape.

Usage

performance_analysis(
  voter_file,
  district_shape,
  census_shape,
  census_data,
  join_census_shape = TRUE,
  join_district_shape = TRUE,
  state = NULL,
  voter_id = "voter_id",
  surname = "last_name",
  district = "district",
  census_state_col = "STATEFP10",
  census_county_col = "COUNTYFP10",
  census_tract_col = "TRACTCE10",
  census_block_col = "BLOCKCE10",
  crs = NULL,
  coords = c("lon", "lat"),
  census_geo = "block",
  use_surname = TRUE,
  surname_only = FALSE,
  surname_year = 2010,
  use_age = FALSE,
  use_sex = FALSE,
  normalize = TRUE,
  verbose = FALSE
)

Arguments

voter_file

A dataframe containing the voter file.

district_shape

The shapefiles for the new districts or precincts to consider.

census_shape

The shapefiles for the Census blocks or tracts for which the voter file will be geocoded against.

census_data

A dataframe containing the Census tracts or blocks in the region for the voter file.

join_census_shape

A logical denoting whether the voter file already has the Census block, tract, and county information. If TRUE, then column names for these items must be provided. If FALSE, then a Census shape must be provided in order to perform a spatial join.

join_district_shape

A logical denoting whether the voter file already has the district identity per voter. If TRUE, then a column names for the district must be provided. If FALSE, then a distrct shape must be provided in order to perform a spatial join.

state

The state in which the functionality analysis is performed, as a two character string.

voter_id

A string denoting the column name for the voter ID.

surname

A string denoting the column name for the surname.

district

A string denoting the column name for the district.

census_state_col

The column in the Census data that indicates state. If the voter file already has Census information, this should denote the column in the voter file containing the state FIPS code.

census_county_col

The column in the Census data that indicates county. If the voter file already has Census information, this should denote the column in the voter file containing the county FIPS code.

census_tract_col

The column in the Census data that indicates tract. If the voter file already has Census information, this should denote the column in the voter file containing the tract FIPS code.

census_block_col

The column in the Census data that indicates block. If the voter file already has Census information, this should denote the column in the voter file containing the block FIPS code.

crs

A string denoting the PROJ4 string for projecting maps.

coords

The columns for the coordinates.

census_geo

The geographic level at which to perform BISG.

use_surname

Whether to use the surname in calculating race probabilities. Passed to WRU.

surname_only

Whether to only use the surname in calculating race probabilities. Passed to WRU.

surname_year

Which Census year to use for surname matching. Passed to WRU.

use_age

Whether to use the age in the BISG calculation. Passed to WRU.

use_sex

Whether to use the sex in the BISG calculation. Passed to WRU.

normalize

If TRUE, normalizes the district percentages.

verbose

If TRUE, will output diagnostic strings.

Value

The processed voter file and a summary of district turnout across racial groups.