Skip to content

Instantly share code, notes, and snippets.

View mschnetzer's full-sized avatar

Matthias Schnetzer mschnetzer

View GitHub Profile
@mschnetzer
mschnetzer / covidmap_bivariate.R
Created January 5, 2022 16:56
Bivariate map for vaccinations and covid cases in Austria (https://twitter.com/matschnetzer/status/1478750626339303424)
#############
#### ACKNOWLEDGMENTS
#############
# Thanks for the original idea and the helpful code to @grssnbchr and @benjazehr: https://timogrossenbacher.ch/2019/04/bivariate-maps-with-ggplot2-and-sf/
#############
#### LOAD PACKAGES
#############
@mschnetzer
mschnetzer / hexagon.R
Created November 12, 2021 10:13
3d Hexagon Map for Covid in Austria [experimental] (https://twitter.com/matschnetzer/status/1459092614318333957?s=20)
library(tidyverse)
library(sf)
library(msthemes)
library(rayshader)
library(wesanderson)
# Download the map here: https://github.com/ginseng666/GeoJSON-TopoJSON-Austria/tree/master/2021
map <- st_read("bezirke_999_geo.json") %>%
mutate(iso = as.numeric(iso),
iso = ifelse(iso %in% 901:923, 900, iso)) %>%
library(tidyverse)
library(ggbump)
library(msthemes)
library(rnaturalearth)
library(rnaturalearthdata)
library(lubridate)
library(sf)
covid <- read_csv("owid-covid-data.csv") %>% filter(continent == "Europe") %>%
group_by(iso_code) %>% drop_na(people_vaccinated_per_hundred) %>%
library(tidyverse)
library(lubridate)
library(msthemes)
library(patchwork)
# Get Covid data by age here: https://www.data.gv.at/katalog/dataset/3765ed62-0f9d-49ad-83b0-1405ed833108
# And vaccination data here: https://www.ages.at/themen/krankheitserreger/coronavirus/
cov <- read_csv2("CovidFaelle_Altersgruppe.csv") %>%
mutate(Time = as.Date(Time, "%d.%m.%Y"))
# This code is adapted from original code by @cnicault https://github.com/cnicault/tidytuesday/tree/master/2021/2021-21-ask_a_manager
library(tidyverse)
library(readxl)
library(scales)
library(ggbump)
library(glue)
library(showtext)
library(msthemes)
library(tidyverse)
library(lubridate)
library(msthemes)
library(ragg)
library(showtext)
# get data from https://www.oenb.at/isaweb/report.do?lang=DE&report=7.17
unemp <- vroom::vroom("unemployment.csv")
font_add_google("Abel", "abel")
@mschnetzer
mschnetzer / covidmap.R
Created October 24, 2020 08:00
Entwicklung der Covid-Pandemie in Österreichs Bezirken (https://twitter.com/matschnetzer/status/1319904508386942976)
library(tidyverse)
library(sf)
library(gganimate)
library(transformr)
library(lubridate)
library(msthemes) # https://github.com/mschnetzer/msthemes
# Import online map
bezirke <- st_read("https://raw.githubusercontent.com/ginseng666/GeoJSON-TopoJSON-Austria/master/2017/simplified-99.9/bezirke_999_geo.json") %>%
mutate(iso = as.numeric(iso))
library(tidyverse)
library(survey)
library(msthemes)
library(gganimate)
library(Hmisc)
# Load HFCS and Non-core data
load("hfcs2017AT.rda")
load("non-core-at.rda")
library(tidyverse)
library(lubridate)
library(msthemes)
library(gganimate)
unemp <- read_csv("unemployment.csv")
df <- unemp %>% filter(period == "month", indicator == "Unemployment registered, total, M-end NSA") %>%
select(year,month,values) %>%
mutate(values = values*1000) %>%
@mschnetzer
mschnetzer / hospbeds.r
Created March 31, 2020 09:51
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)) +