race_prep: Order race values before plot

Description Usage Arguments Value

View source: R/race_prep.R

Description

Function to order race consistently for graph colors. Dataframe must have a race column with values matching those in race_vector_order. Should run before running plotly.

Usage

1
2
3
4
5
6
race_prep(
  df,
  race_col = "race",
  race_vector_order = c("Black", "Hispanic", "White", "Asian", "Other",
    "Native American")
)

Arguments

df

a stops or arrests dataframe with a race column

race_col

a column for race/ethnicity values in the arrest/stops dataframe

race_vector_order

character vector of how to order race-values appearing in dataframe in visualizations

Value

df with race column ordered as factor


dpowerstp/arrprocess documentation built on Dec. 20, 2021, 1:12 a.m.