Skip to content

Instantly share code, notes, and snippets.

@USMortality
Created September 14, 2024 01:20
Show Gist options
  • Save USMortality/fb9aa8867a856e7cfa5f9641eb06b532 to your computer and use it in GitHub Desktop.
Save USMortality/fb9aa8867a856e7cfa5f9641eb06b532 to your computer and use it in GitHub Desktop.
Steuerquote pro BIP [Deutschland]
library(readr)
library(tidyr)
library(ggplot2)
library(dplyr)
sf <- 2
options(vsc.dev.args = list(width = 600 * sf, height = 335 * sf, res = 72 * sf))
taxes <- read_delim(
"https://apify.mortality.watch/destatis-genesis/71211-0001.csv",
delim = ";", skip = 6,
locale = locale(encoding = "latin1")
) |>
slice(1) |>
select(2:last_col()) |>
pivot_longer(cols = 1:last_col()) |>
setNames(c("year", "taxes")) |>
mutate(taxes = as.integer(taxes) / 1e6)
gdp <- read_delim(
"https://apify.mortality.watch/destatis-genesis/81000-0005.csv",
delim = ";", skip = 6,
locale = locale(encoding = "latin1")
) |>
slice(1) |>
select(3:last_col()) |>
pivot_longer(cols = 1:last_col()) |>
setNames(c("year", "gdp")) |>
mutate(gdp = as.integer(gdp) / 1e3)
ts <- taxes |>
inner_join(gdp) |>
mutate(
year = as.integer(year),
taxes_per_gdp = (taxes / gdp) * 100
)
ggplot(ts, aes(x = year, y = taxes_per_gdp)) +
geom_line() +
scale_y_continuous(
limits = c(19, 23),
labels = scales::percent_format(scale = 1)
) +
labs(
x = "Jahr", y = "Steuereinahmen (% des BIP)",
title = "Steuerquote pro BIP [Deutschland]",
subtitle = "Source: Destatis/Genesis: 71211-0001, 81000-0005"
) +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment