Skip to content

Instantly share code, notes, and snippets.

@cndesantana
Last active June 16, 2020 20:41
Show Gist options
  • Select an option

  • Save cndesantana/ea2243fdbd802976e98a2d065a93f041 to your computer and use it in GitHub Desktop.

Select an option

Save cndesantana/ea2243fdbd802976e98a2d065a93f041 to your computer and use it in GitHub Desktop.
COVID19 Death Rate of cities in NE Brazil with population greater than 600K and at least 100 deaths by COVID19
library(tidyverse)
library(lubridate)
link = "https://brasil.io/dataset/covid19/caso/?place_type=city&format=csv"
dat = read.csv(link, stringsAsFactors = FALSE)
dat <- dat %>% mutate(date = ymd(date))
png("hires.png", width=3200,height=1800,res=300)
dat %>%
filter(state %in% c("BA","CE","PE","MA")) %>%
filter(estimated_population_2019 > 600000,
max(confirmed) > 100) %>%
arrange(date) %>%
filter(date > ymd("2020-03-15")) %>%
ggplot(aes(x = date, y = 100*death_rate, col = city)) +
geom_line(stat="identity") +
scale_y_log10() +
theme_bw() +
labs(title = "Taxa de letalidade por COVID19 em Cidades do NE (%)",
subtitle = "Cidades com mais de 600K Hab e mais de 100 Mortes",
x = "Data",
y = "Taxa de letalidade (%)",
col ="Cidade")
dev.off()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment