Skip to content

Instantly share code, notes, and snippets.

@mschnetzer
Created March 31, 2020 09:51
Show Gist options
  • Save mschnetzer/db411c10e8a9de2b3c925d4cbced858b to your computer and use it in GitHub Desktop.
Save mschnetzer/db411c10e8a9de2b3c925d4cbced858b to your computer and use it in GitHub Desktop.
Zahl und Entwicklung der Spitalsbetten
library(tidyverse)
library(eurostat)
library(msthemes)
library(patchwork)
beds <- get_eurostat("hlth_rs_bds", filters = list(unit = "P_HTHAB", facility = "HBEDT", time = 2000:2017), time_format = "num")
abs <- beds %>% filter(geo %in% c("AT","DE","FR","ES","IT","SE","UK"), time == 2017) %>%
ggplot(aes(x = reorder(geo, values), y = values)) +
geom_bar(stat = "identity", aes(fill=geo)) +
scale_fill_viridis_d() +
coord_flip() +
theme_ms() +
theme(panel.grid.major.y = element_blank(),
legend.position = "none",
axis.title = element_text(size = 7)) +
labs(x = "", y="Betten pro 100.000 EW.")
devb <- beds %>% filter(geo %in% c("AT","DE","FR","ES","IT","SE","UK")) %>%
group_by(geo) %>%
mutate(startval = case_when(time == 2000 ~ values, TRUE ~ NA_real_)) %>%
fill(startval) %>% mutate_at(vars(values), ~./startval*100) %>%
ggplot(aes(x=time,y=values)) +
geom_line(aes(color=geo), size = 1.2) +
scale_color_viridis_d(name="") +
theme_ms() +
theme(axis.title = element_text(size = 7)) +
labs(x="", y="Entwicklung (2000 = 100)")
finplot <- (abs | devb) +
plot_annotation(title = "Sparkurs im Gesundheitswesen",
subtitle = "Spitalsbetten in ausgewählten EU-Ländern, 2017",
caption = "Daten: Eurostat. Grafik: @matschnetzer",
theme = theme_ms(alttf = T)) +
ggsave("hspbeds.png", dpi = 300, width = 8, height = 4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment