Skip to content

Instantly share code, notes, and snippets.

@mschnetzer
Last active November 2, 2018 10:58
Show Gist options
  • Save mschnetzer/61c3b452d8170cba2d81df44bcf99d3f to your computer and use it in GitHub Desktop.
Save mschnetzer/61c3b452d8170cba2d81df44bcf99d3f to your computer and use it in GitHub Desktop.
Anteil der Ausgaben für Miete am verfügbaren Haushaltseinkommen, 2017 (https://twitter.com/matschnetzer/status/1058312258978308097)
library(tidyverse)
library(msmaps)
library(eurostat)
data <- get_eurostat("ilc_mded02",filters=list(hhtyp="TOTAL",incgrp="TOTAL",time=c("2016","2017")),type="code",time_format="num") %>%
mutate(geo=recode(geo,"UK"="GB","EL"="GR")) %>% select(geo,time,values) %>%
group_by(geo) %>% fill(values) %>% filter(time==2017)
mapdata <- data %>%
mutate(cat = cut(values, breaks = c(0,15,20,25,30,35))) %>% select(geo,cat) %>%
mutate(cat=recode(cat,"(0,15]"=" 0-15%","(15,20]"=" 15-20%","(20,25]"=" 20-25%","(25,30]"=" 25-30%","(30,35]"=" 30-35%"))
ploteurope(mapdata,fillvar="cat",colpal=msc_palette[5:1],tit="Wie hoch sind die Wohnkosten?",
subtit = "Anteil der Ausgaben für Miete am verfügbaren Einkommen, 2017",
captit = "UK, IE, CH, RS: Daten für 2016. Daten: Eurostat. Grafik: @matschnetzer",
savfile = "wohnausgaben.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment