Created
June 2, 2020 08:40
-
-
Save jlopezper/8b14d4bbee7a507e6fe395b360cf6e60 to your computer and use it in GitHub Desktop.
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(tidyverse) | |
library(lubridate) | |
tst <- readr::read_csv('https://raw.githubusercontent.com/washingtonpost/data-police-shootings/master/fatal-police-shootings-data.csv') | |
tst1 <- | |
tst %>% | |
filter(race != 'N', year(date) < 2020) %>% | |
mutate(Raza = ifelse(race == 'W', 'Blancos', 'Otros')) %>% | |
filter(armed == 'unarmed') %>% | |
group_by(year = year(date), Raza) %>% | |
summarise(n = n()) | |
tst %>% | |
count(armed) %>% | |
filter(n > 10) %>% | |
filter(!is.na(armed)) %>% | |
ggplot(aes(x = reorder(armed, n), y = n)) + | |
geom_bar(stat="identity") + | |
coord_flip() + theme_minimal() + | |
labs(x = 'Situación') | |
ggplot(tst1, aes(x = year, y = n, group = Raza)) + | |
geom_line(aes(color = Raza)) + | |
geom_point(aes(color = Raza)) + theme_minimal() + | |
labs(title= 'Número de personas desarmadas muertas por disparos policiales') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment