~/data/eurostat/

Info

DOWNLOAD_TIME

tibble(DOWNLOAD_TIME = as.Date(file.info("~/Dropbox/website/data/eurostat/gov_10a_exp.RData")$mtime)) %>%
  print_table_conditional()
DOWNLOAD_TIME
2024-04-18

Last

gov_10a_exp %>%
  group_by(time) %>%
  summarise(Nobs = n()) %>%
  arrange(desc(time)) %>%
  head(1) %>%
  print_table_conditional()
time Nobs
2022 1261510

unit

gov_10a_exp %>%
  left_join(unit, by = "unit") %>%
  group_by(unit, Unit) %>%
  summarise(Nobs = n()) %>%
  arrange(-Nobs) %>%
  print_table_conditional
unit Unit Nobs
MIO_EUR Million euro 9647371
PC_GDP Percentage of gross domestic product (GDP) 9647371
MIO_NAC Million units of national currency 9647339
PC_TOT Percentage of total 4593919

sector

gov_10a_exp %>%
  left_join(sector, by = "sector") %>%
  group_by(sector, Sector) %>%
  summarise(Nobs = n()) %>%
  arrange(-Nobs) %>%
  print_table_conditional
sector Sector Nobs
S13 General government 7497847
S1311 Central government 6711144
S1313 Local government 6616004
S1314 Social security funds 6447220
S1312 State government 6263785

cofog99

All

gov_10a_exp %>%
  left_join(cofog99, by = "cofog99") %>%
  group_by(cofog99, Cofog99) %>%
  summarise(Nobs = n()) %>%
  print_table_conditional

2 digit

gov_10a_exp %>%
  left_join(cofog99, by = "cofog99") %>%
  group_by(cofog99, Cofog99) %>%
  summarise(Nobs = n()) %>%
  filter(nchar(cofog99) == 4) %>%
  print_table_conditional
cofog99 Cofog99 Nobs
GF01 Services généraux des administrations publiques 480863
GF02 Défense 478392
GF03 Ordre et sécurité publics 479025
GF04 Affaires économiques 479049
GF05 Protection de l’environnement 478884
GF06 Logements et équipements collectifs 479089
GF07 Santé 481573
GF08 Loisirs, culture et culte 480617
GF09 Enseignement 480267
GF10 Protection sociale 482514

na_item

gov_10a_exp %>%
  left_join(na_item, by = "na_item") %>%
  group_by(na_item, Na_item) %>%
  summarise(Nobs = n()) %>%
  arrange(-Nobs) %>%
  print_table_conditional

geo

gov_10a_exp %>%
  left_join(geo, by = "geo") %>%
  group_by(geo, Geo) %>%
  summarise(Nobs = n()) %>%
  arrange(-Nobs) %>%
  mutate(Flag = gsub(" ", "-", str_to_lower(Geo)),
         Flag = paste0('<img src="../../bib/flags/vsmall/', Flag, '.png" alt="Flag">')) %>%
  select(Flag, everything()) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .}

time

gov_10a_exp %>%
  group_by(time) %>%
  summarise(Nobs = n()) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

Germany VS France

General Public Services - TOTAL

gov_10a_exp %>%
  filter(geo %in% c("FR", "DE"),
         unit == "PC_GDP",
         sector == "S13",
         cofog99 == "TOTAL",
         na_item == "TE") %>%
  year_to_date %>%
  select(date, geo, na_item, values) %>%
  left_join(geo , by = "geo") %>%
  mutate(values = values / 100) %>%
  left_join(colors, by = c("Geo" = "country")) %>%
  ggplot + geom_line(aes(x = date, y = values, color = color)) +
  theme_minimal()  + add_2flags + xlab("") + ylab("") + scale_color_identity() +
  scale_x_date(breaks = as.Date(paste0(seq(1960, 2020, 5), "-01-01")),
               labels = date_format("%y")) +
  scale_y_continuous(breaks = 0.01*seq(-30, 80, 2),
                labels = percent_format(a = 1))

Germany VS France

General Public Services - TOTAL

gov_10a_exp %>%
  filter(geo %in% c("FR", "DE"),
         unit == "MIO_EUR",
         sector == "S13",
         cofog99 == "TOTAL",
         na_item %in% c("P5", "TE")) %>%
  year_to_date %>%
  select(date, geo, na_item, values) %>%
  spread(na_item, values) %>%
  left_join(geo , by = "geo") %>%
  mutate(values = P5 / TE) %>%
  ggplot + geom_line(aes(x = date, y = values, color = Geo)) +
  theme_minimal()  +
  scale_x_date(breaks = as.Date(paste0(seq(1960, 2020, 5), "-01-01")),
               labels = date_format("%y")) +
  add_2flags +
  scale_color_manual(values = c("#002395", "#000000")) +
  theme(legend.position = "none") +
  xlab("") + ylab("Eurostat (P5 / TE de gov_10a_exp)") +
  scale_y_continuous(breaks = 0.01*seq(-30, 30, 1),
                labels = percent_format(a = 1))

Germany VS France

General Public Services - GF01

gov_10a_exp %>%
  filter(geo %in% c("FR", "DE"),
         unit == "PC_TOT",
         sector == "S13",
         cofog99 == "GF01",
         na_item == "P5") %>%
  year_to_date %>%
  left_join(geo , by = "geo") %>%
  ggplot + geom_line(aes(x = date, y = values / 100, color = Geo)) +
  theme_minimal()  +
  scale_x_date(breaks = as.Date(paste0(seq(1960, 2020, 5), "-01-01")),
               labels = date_format("%y")) +
  scale_color_manual(values = viridis(3)[1:2]) +
  theme(legend.position = c(0.35, 0.85),
        legend.title = element_blank()) +
  xlab("") + ylab("GF01 - Services généraux des admin pub") +
  scale_y_continuous(breaks = 0.01*seq(-30, 30, 1),
                labels = percent_format(a = 1))

2-digit

gov_10a_exp %>%
  filter(geo %in% c("FR", "DE"),
         unit == "PC_TOT",
         time == "2019",
         sector == "S13",
         nchar(cofog99) == 4,
         na_item == "P5") %>%
  left_join(geo , by = "geo") %>%
  left_join(cofog99 , by = "cofog99") %>%
  select(Geo, cofog99, Cofog99, values) %>%
  mutate(Geo = gsub(" ", "-", str_to_lower(gsub(" ", "-", Geo))),
         Geo = paste0('<img src="../../icon/flag/vsmall/', Geo, '.png" alt="Flag">')) %>%
  spread(Geo, values) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .}

4-digit

gov_10a_exp %>%
  filter(geo %in% c("FR", "DE"),
         unit == "PC_TOT",
         time == "2019",
         sector == "S13",
         na_item == "P5") %>%
  left_join(geo , by = "geo") %>%
  left_join(cofog99 , by = "cofog99") %>%
  select(Geo, cofog99, Cofog99, values) %>%
  mutate(Geo = gsub(" ", "-", str_to_lower(gsub(" ", "-", Geo))),
         Geo = paste0('<img src="../../icon/flag/vsmall/', Geo, '.png" alt="Flag">')) %>%
  spread(Geo, values) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .}