Created
February 15, 2023 05:38
-
-
Save Deleetdk/21f4571b79ad9331776012fa35ae0af0 to your computer and use it in GitHub Desktop.
interracial rape stats
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(googlesheets4) | |
library(kirkegaard) | |
theme_set(theme_bw()) | |
#read data | |
d = read_sheet("https://docs.google.com/spreadsheets/d/1cPApEVEPNj4DXTB7LN7hd7B6WxYQiottbfHFt72tCzE/edit#gid=0") | |
#transform to long form for plotting | |
d_long = d %>% | |
pivot_longer( | |
cols = -Year, | |
names_to = "type", | |
values_to = "proportion" | |
) %>% mutate( | |
perp = str_match(type, "\\w+\\b")[, 1], | |
victim = str_match(type, "\\w+$")[, 1], | |
) | |
d_long %>% | |
select(-type) %>% | |
ggplot(aes(Year, proportion, color = perp)) + | |
geom_line() + | |
facet_wrap("victim", labeller = "label_both") | |
GG_save("interracial rape stats.png") | |
#stats | |
describe2(d) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment