Skip to content

Instantly share code, notes, and snippets.

@b-rodrigues
Created December 19, 2021 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save b-rodrigues/9ed23236acce960ccec6f465403e14db to your computer and use it in GitHub Desktop.
Save b-rodrigues/9ed23236acce960ccec6f465403e14db to your computer and use it in GitHub Desktop.
library(dplyr)
library(ggplot2)
library(lubridate)
library(COVID19)
covid <- covid19()
cases_deaths <- covid %>%
filter(iso_alpha_3 %in% c("AUT", "BEL", "BGR", "HRV",
"CYP", "CZE", "DNK", "EST",
"FIN", "FRA", "DEU", "GRC",
"HUN", "IRL", "ITA", "LVA",
"LTU", "LUX", "MLT", "NLD",
"PRT", "ROU", "SVK", "SVN",
"ESP", "SWE", "GBR", "CHE")) %>%
filter(date == ymd("2021-03-01")) %>%
select(country = administrative_area_level_1,
cumulative_cases = confirmed,
cumulative_deaths = deaths,
population) %>%
mutate(cases_100k = cumulative_cases/population*100000,
deaths_100k = cumulative_deaths/population*100000)
vaxxed <- covid %>%
filter(iso_alpha_3 %in% c("AUT", "BEL", "BGR", "HRV",
"CZE", "DNK", "EST",
"FIN", "FRA", "DEU", "GRC",
"HUN", "IRL", "ITA", "LVA",
"LTU", "LUX", "MLT", "NLD",
"PRT", "SVK", "SVN",
"SWE", "GBR", "CHE")) %>%
filter(date == ymd("2021-12-05")) %>%
select(country = administrative_area_level_1,
people_vaccinated,
population) %>%
mutate(vaxxed_100k = people_vaccinated/population*100000)
vaxxed2 <- covid %>%
filter(iso_alpha_3 %in% c("ROU", "ESP")) %>%
filter(date == ymd("2021-12-12")) %>%
select(country = administrative_area_level_1,
people_vaccinated,
population) %>%
mutate(vaxxed_100k = people_vaccinated/population*100000)
vaxxed3 <- covid %>%
filter(iso_alpha_3 %in% c("CYP")) %>%
filter(date == ymd("2021-12-14")) %>%
select(country = administrative_area_level_1,
people_vaccinated,
population) %>%
mutate(vaxxed_100k = people_vaccinated/population*100000)
vaxxed <- bind_rows(vaxxed,
vaxxed2,
vaxxed3)
cases_deaths_vs_vaxxed <- full_join(cases_deaths,
vaxxed)
ggplot(cases_deaths_vs_vaxxed) +
geom_point(aes(y = cases_100k,
x = vaxxed_100k,
size = deaths_100k)) +
ggrepel::geom_label_repel(aes(y = cases_100k,
x = vaxxed_100k,
label = country)) +
theme_dark() +
labs(title = "Cumulative cases per 100k inhabitants as of the 1st of March 2021 vs
cumulative people who received one vaccine doses per 100k inhabitants as of mid December 2021",
subtitle = "A worst first wave seems to correlate to higher vaccination rates",
caption = "Data source: {COVID19} R package.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment