# Toy data example
cand_a <- c( rep(.8, 10), rep(.2, 10))
cand_b <- 1 - cand_a
white <- c(rep(.7, 5), rep(.85, 5), rep(.1, 5), rep(.05, 5))
black <- 1 - white
total <- c ( rep(200, 5), rep(100, 5), rep(80, 5), rep(300, 5) )
toy <- data.frame(cand_a, cand_b, white, black, total)
# Default Example #
ei_homog(data = toy,
race_cols = c("white", "black"),
cand_cols = c("cand_a", "cand_b"),
totals_col = "total")
# Verbosity Example #
ei_homog(data = toy,
race_cols = c("white", "black"),
cand_cols = c("cand_a", "cand_b"),
totals_col = "total",
verbose = TRUE)
# Adjust Cut Point (cp) to 0.70
ei_homog(data = toy,
race_cols = c("white", "black"),
cand_cols = c("cand_a", "cand_b"),
totals_col = "total",
cp = 0.70,
verbose = TRUE)
# Set Precincts to anything above 3
ei_homog(data = toy,
race_cols = c("white", "black"),
cand_cols = c("cand_a", "cand_b"),
totals_col = "total",
warn_row = 3,
verbose = TRUE)
Run the code above in your browser using DataLab