library(dplyr)
library(ggplot2)
# List percent of total for each race
mn_police_use_of_force %>%
count (race) %>%
mutate (percent= round(n/sum(n)*100,2)) %>%
arrange(desc(percent))
# Display use of force count by three races
race_sub = c("Asian","White","Black")
ggplot(mn_police_use_of_force %>% filter(race %in% race_sub),
aes(force_type, ..count.. ) ) +
geom_point(stat = "count", size = 4) +
coord_flip()+
facet_grid( race ~ . )+
labs(x = "Force Type",
y = "Number of Incidents")
Run the code above in your browser using DataLab