# \donttest{
library(eiExpand)
library(sf)
# load data and shps
data(planShp); data(vtd); data(mt_block_data)
# filter to a few vtds for this example
vtd <- vtd %>%
dplyr::filter(
GEOID20 %in% c("30091000002", "30085000012", "30085000018", "30085000010")
)
# run split precinct analysis without plots
spa_results <- split_precinct_analysis(
vtd = vtd,
planShp = planShp,
block_pop_data = mt_block_data,
vote_col_names = c('G16HALRZIN', 'G16HALDJUN', 'G16HALLBRE',
'G16GOVRGIA', 'G16GOVDBUL', "G16GOVLDUN"),
keepOrigElection = TRUE,
generatePlots = FALSE)
# run with plots
spa_list <- split_precinct_analysis(
vtd = vtd,
planShp = planShp,
block_pop_data = mt_block_data,
vote_col_names = c('G16HALRZIN', 'G16HALDJUN', 'G16HALLBRE',
'G16GOVRGIA', 'G16GOVDBUL', "G16GOVLDUN"),
lower_thresh = 0,
keepOrigElection = TRUE,
generatePlots = TRUE)
# View results
spa_list[["results"]]
# View plots
#library(gridExtra)
#do.call("grid.arrange", c(spa_list[["plots"]], ncol=1))
# }
Run the code above in your browser using DataLab