Learn R Programming

eiCompare (version 3.0.4)

plot_bivariate: Plot bivariate relationships between all combinations of candidates and race/ethnicities

Description

Plot bivariate relationships between all combinations of candidates and race/ethnicities

Usage

plot_bivariate(
  data,
  cand_cols,
  race_cols,
  corrs = FALSE,
  save = FALSE,
  path = NULL
)

Value

ggplot object with bivariate plots faceted by candidate and race

Arguments

data

A data.frame() object containing precinct-level turnout data by race and candidate

cand_cols

A character vector listing the column names for turnout for each candidate

race_cols

A character vector listing the column names for turnout by race

corrs

A boolean indicating whether to include correlation coefficients on the plot.

save

A boolean indicating whether to save the plot to a file.

path

A string to specify plot save location. If NULL, plot is not saved.