Last active
February 13, 2025 04:11
-
-
Save USMortality/fb9aa8867a856e7cfa5f9641eb06b532 to your computer and use it in GitHub Desktop.
Steuerquote pro BIP [Deutschland]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(readr) | |
library(tidyr) | |
library(ggplot2) | |
library(dplyr) | |
sf <- 2 | |
width <- 600 * sf | |
height <- 335 * sf | |
options(vsc.dev.args = list(width = width, height = height, res = 72 * sf)) | |
taxes <- read_delim( | |
"https://apify.mortality.watch/destatis-genesis/71211-0001.csv.gz", | |
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.gz", | |
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 | |
) | |
chart <- 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)) | |
ggplot2::ggsave( | |
filename = "chart1.png", plot = chart, width = width, height = height, | |
units = "px", dpi = 72 * sf, device = grDevices::png, type = c("cairo") | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://www.mortality.watch/charts/list.html#steuerquote-pro-bip-deutschland