Skip to content

Instantly share code, notes, and snippets.

@felixgolcher
Created November 24, 2021 11:29
Show Gist options
  • Save felixgolcher/4eea0aaa397aa6fe12b573204541f625 to your computer and use it in GitHub Desktop.
Save felixgolcher/4eea0aaa397aa6fe12b573204541f625 to your computer and use it in GitHub Desktop.
inzidenz über impfquote
library(tidyverse)
library(ggrepel)
library(readxl)
download.file("https://www.rki.de/DE/Content/InfAZ/N/Neuartiges_Coronavirus/Daten/Impfquotenmonitoring.xlsx?__blob=publicationFile",
"Impfquotenmonitoring.xlsx")
# https://de.statista.com/statistik/daten/studie/1178874/umfrage/bundeslaender-mit-den-meisten-coronainfektionen-in-der-letzten-woche/
# no automatic download.
read_excel("statistic_id1178874_bundeslaender-mit-den-meisten-coronainfektionen-in-der-letzten-woche.xlsx",
sheet = 2, skip = 4, col_names = F) %>%
set_names(c("Bundesland", "Inzidenz")) %>%
filter(Bundesland != "Bundesweit") %>%
mutate(Bundesland = recode(Bundesland, "Schleswig Holstein"="Schleswig-Holstein"),
Inzidenz = as.numeric(Inzidenz))-> inz
read_excel("Impfquotenmonitoring.xlsx",
sheet = "Impfquote_bundesweit_Alter",
skip = 3,
col_names = F) %>%
select(c(2,7)) %>%
set_names(c("Bundesland","Impfquote")) %>%
filter(!is.na(Impfquote)) %>%
filter(!Bundesland %in% c("Bundesressorts***",
"Gesamt")) %>%
mutate(Impfquote = as.numeric(Impfquote)) %>%
full_join(inz) %>%
ggplot(aes(Impfquote, Inzidenz, label = Bundesland)) +
geom_point()+
geom_text_repel()+
theme_bw()+
geom_smooth(col = "red", span = .9)
ggsave("impf.jpg")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment