Global Revenue Statistics - RS_GBL

Data - OECD

Code
RS_GBL <- read_parquet("RS_GBL.parquet")
load_data("oecd/RS_GBL_var.RData")

Data Structure

Code
RS_GBL_var$VAR_DESC %>%
  {if (is_html_output()) print_table(.) else .}
id description
COU Country
GOV Level of government
TAX Tax revenue
VAR Indicator
YEA Year
OBS_VALUE Observation Value
TIME_FORMAT Time Format
OBS_STATUS Observation Status

GOV

Code
RS_GBL |>
  left_join(RS_GBL_var$GOV |> setNames(c("GOV", "GOV_desc")), by = "GOV") |>
  group_by(GOV, GOV_desc) |>
  summarise(Nobs = n()) %>%
  {if (is_html_output()) print_table(.) else .}
GOV GOV_desc Nobs
FED Federal or Central government 408240
LOCAL Local government 212325
NES Total 457232
SOCSEC Social Security Funds 137312
STATE State/Regional 66026
SUPRA Supranational 48425

TAX

Code
RS_GBL |>
  left_join(RS_GBL_var$TAX |> setNames(c("TAX", "TAX_desc")), by = "TAX") |>
  group_by(TAX, TAX_desc) |>
  summarise(Nobs = n()) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

VAR

Code
RS_GBL |>
  left_join(RS_GBL_var$VAR |> setNames(c("VAR", "VAR_desc")), by = "VAR") |>
  group_by(VAR, VAR_desc) |>
  summarise(Nobs = n()) %>%
  {if (is_html_output()) print_table(.) else .}
VAR VAR_desc Nobs
TAXGDP Tax revenue as % of GDP 339371
TAXNAT Tax revenue in national currency 319808
TAXPER Tax revenue as % of total taxation 336152
TAXUSD Total tax revenue in USD 334229

Ex 1: Total Taxes in Germany

Code
RS_GBL |>
  filter(COU == "DEU",
         GOV == "NES",
         TAX == "TOTALTAX",
         VAR == "TAXNAT") |>
  year_to_date() |>
  filter(date >= as.Date("1995-01-01"),
         date <= as.Date("2020-01-01")) |>
  ggplot() + 
  geom_line(aes(x = date, y = obsValue)) + theme_minimal() +
  theme(legend.title = element_blank(),
        legend.position = c(0.1, 0.25)) +
  scale_x_date(breaks = as.Date(paste0(seq(1920, 2020, 1), "-01-01")),
               labels = date_format("%Y")) + 
  scale_y_continuous(breaks = seq(-0.10, 0.03, 0.01),
                     labels = scales::percent_format(accuracy = 1)) +
  xlab("") + ylab("Total Taxes in Germany") +
  scale_y_continuous(breaks = seq(0, 2000, 100),
                     labels = dollar_format(suffix = " Bn€", prefix = "", accuracy = 1)) +
  geom_rect(data = data_frame(start = as.Date("1998-01-01"), 
                              end = as.Date("1999-01-01")),
            aes(xmin = start, xmax = end, ymin = -Inf, ymax = +Inf), 
            fill = viridis(3)[2], alpha = 0.2) + 
  geom_vline(xintercept = as.Date("1998-01-01"), linetype = "dashed", color = viridis(3)[2]) + 
  geom_vline(xintercept = as.Date("1999-01-01"), linetype = "dashed", color = viridis(3)[2])

Ex 2: Total Taxes in Germany (% of GDP)

Code
RS_GBL |>
  filter(COU == "DEU",
         GOV == "NES",
         TAX == "TOTALTAX",
         VAR == "TAXGDP") |>
  year_to_date() |>
  filter(date >= as.Date("1995-01-01"),
         date <= as.Date("2020-01-01")) |>
  ggplot() + xlab("") + ylab("Total Taxes (% of GDP)") +
  geom_line(aes(x = date, y = obsValue/100)) + theme_minimal() +
  theme(legend.title = element_blank(),
        legend.position = c(0.1, 0.25)) +
  scale_x_date(breaks = as.Date(paste0(seq(1920, 2020, 1), "-01-01")),
               labels = date_format("%Y")) + 
  scale_y_continuous(breaks = seq(0, 0.50, 0.005),
                     labels = scales::percent_format(accuracy = 0.1))

Ex 3: 5100: VAT Taxes

Germany

Code
RS_GBL |>
  filter(COU == "DEU",
         GOV == "NES",
         TAX %in% c("5100", "5110", "5120"),
         VAR == "TAXGDP") |>
  select(TAX, obsValue, obsTime) |>
  year_to_enddate() |>
  left_join(RS_GBL_var$TAX |> setNames(c("TAX", "TAX_desc")), by = "TAX") |>
  ggplot() + theme_minimal() + xlab("") + ylab("") +
  geom_line(aes(x = date, y = obsValue/100, color = TAX_desc, linetype = TAX_desc)) +
  scale_color_manual(values = viridis(4)[1:3]) +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  theme(legend.position = c(0.6, 0.9),
        legend.title = element_blank(),
        legend.direction = "vertical") +
  scale_y_continuous(breaks = 0.01*seq(00, 150, 1),
                     labels = scales::percent_format(accuracy = 1),
                     limits = 0.01*c(2.5, 13))

France

Code
RS_GBL |>
  filter(COU == "FRA",
         GOV == "NES",
         TAX %in% c("5100", "5110", "5120"),
         VAR == "TAXGDP") |>
  select(TAX, obsValue, obsTime) |>
  year_to_enddate() |>
  left_join(RS_GBL_var$TAX |> setNames(c("TAX", "TAX_desc")), by = "TAX") |>
  ggplot() + theme_minimal() + xlab("") + ylab("") +
  geom_line(aes(x = date, y = obsValue/100, color = TAX_desc, linetype = TAX_desc)) +
  scale_color_manual(values = viridis(4)[1:3]) +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  theme(legend.position = c(0.6, 0.9),
        legend.title = element_blank(),
        legend.direction = "vertical") +
  scale_y_continuous(breaks = 0.01*seq(00, 150, 1),
                     labels = scales::percent_format(accuracy = 1),
                     limits = 0.01*c(2.5, 16))

Japan

Code
RS_GBL |>
  filter(COU == "JPN",
         GOV == "NES",
         TAX %in% c("5100", "5110", "5120"),
         VAR == "TAXGDP") |>
  select(TAX, obsValue, obsTime) |>
  year_to_enddate() |>
  left_join(RS_GBL_var$TAX |> setNames(c("TAX", "TAX_desc")), by = "TAX") |>
  ggplot() + theme_minimal() + xlab("") + ylab("") +
  geom_line(aes(x = date, y = obsValue/100, color = TAX_desc, linetype = TAX_desc)) +
  scale_color_manual(values = viridis(4)[1:3]) +
  scale_x_date(breaks = seq(1960, 2100, 5) |> paste0("-01-01") |> as.Date(),
               labels = date_format("%Y")) +
  theme(legend.position = c(0.6, 0.9),
        legend.title = element_blank(),
        legend.direction = "vertical") +
  scale_y_continuous(breaks = 0.01*seq(00, 150, 1),
                     labels = scales::percent_format(accuracy = 1),
                     limits = 0.01*c(0, 8))