.libPaths('R:/Project/UWED/html/_site/site_libs/')
library(tools)

knitr::opts_chunk$set(warning = FALSE, message = FALSE)

# db connection
# source("../code/dbconnect.R")
# U <- uwed <- connectdb(dbname = "uwed", host = "doyenne.csde.washington.edu", user = "uwed_user", password = Sys.getenv("uwed_user_pgpassword"))

# files
md5_f1 <- md5sum("precinct_census_cvap_agg_votes_nogeog.zip")
md5_f2 <- md5sum("Registrant_Population_by_Precinct_Race_Year.csv")
md5_f3 <- md5sum("Voter_Population_by_Precinct_Election_Race_Year.csv")
md5_f4 <- md5sum("language_minority_groups.zip")

Data sets

Population by Race, Precinct, Election, and Year

File 1: precinct_census_cvap_agg_votes_nogeog.zip, md5sum = NA

This data set contains racial group count and proportion estimates by each precinct and year in Washington State. We use census data on tract-level (2009-2012) or block group-level (all other years) citizen voting age population (CVAP) by race and ethnicity to estimate the same value at a precinct level.

We do this by using an area weighting factor derived by intersecting precinct polygons (that may vary by year) and Census unit polygons. For more information on methodology, please visit technical documentation

Registrants by Race, Precinct, and Year

File 2: Registrant_Population_by_Precinct_Race_Year.csv, md5sum = NA

Voter registration data is geolocated by address and then race is imputed using Bayesian Improved Surname Geocoding. This individual-level data is then aggregated to precincts to create demographic estimates of the precinct-level registered population by race for years 2008-2023.

Voters by Race, Precinct, Year, and Election

File 3: Voter_Population_by_Precinct_Election_Race_Year.csv, md5sum = NA

Similar to registrant data, voter data is geolocated by address and then race is imputed using Bayesian Improved Surname Geocoding. This individual-level data is then aggregated to precincts to create demographic estimates of the precinct-level voting population by race for years 2019-2023 for each election. A person is considered a voter in a given election if their ballot is of Accepted status.

Language Minority Population by County and Year

File 4: language_minority_groups.zip, md5sum = NA

This dataset contains population counts and proportions for each language minority group in each county in Washington State, and designations of which counties are required to provide language assistance during elections for certain language minority groups who are unable to speak or understand English adequately enough to participate in the electoral process. The dataset covers all 39 counties in Washington State for the years 2011, 2016, and 2021.

There are two data files:

sec203_counties_only.csv provides details on the counties required to provide language assistance.

all_counties.csv provides language minority population data for all counties in Washington State.

Notes

For users of R statistical software, use read.csv(..., na.strings = "") when importing the CSV files. This will allow blank cells in the CSV to be read as missing observations (i.e., NA) properly.