Government at a Glance - GOV

Data - OECD

IND

Code
GOV %>%
  left_join(GOV_var$IND, by = "IND") %>%
  group_by(IND, Ind) %>%
  summarise(Nobs = n()) %>%
  arrange(-Nobs) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

COU

Code
GOV %>%
  left_join(GOV_var$COU, by = "COU") %>%
  group_by(COU, Cou) %>%
  summarise(Nobs = n()) %>%
  arrange(-Nobs) %>%
  arrange(-Nobs) %>%
  mutate(Flag = gsub(" ", "-", str_to_lower(gsub(" ", "-", Cou))),
         Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) %>%
  select(Flag, everything()) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .}

France, Germany

% of GDP

Code
GOV %>%
  filter(COU %in% c("FRA", "DEU"),
         IND == "GINV_GDP") %>%
  year_to_date %>%
  left_join(GOV_var$COU, by = "COU") %>%
  ggplot() + geom_line(aes(x = date, y = obsValue/100, color = Cou)) + 
  theme_minimal() + ylab("Government investment (% of GDP)") + xlab("") +
  geom_image(data = . %>%
               filter(date == as.Date("2014-01-01")) %>%
               mutate(image = paste0("../../icon/flag/", str_to_lower(gsub(" ", "-", Cou)), ".png")),
             aes(x = date, y = obsValue/100, image = image), asp = 1.5) +
  scale_color_manual(values = c("#002395", "#000000")) +
  theme(legend.position = "none") +
  scale_x_date(breaks = seq(1920, 2025, 1) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 0.2),
                     labels = scales::percent_format(accuracy = .1))

% of Expenditures

Code
GOV %>%
  filter(COU %in% c("FRA", "DEU"),
         IND == "GINV_GTE") %>%
  year_to_date %>%
  left_join(GOV_var$COU, by = "COU") %>%
  ggplot() + geom_line(aes(x = date, y = obsValue/100, color = Cou)) + 
  theme_minimal() + ylab("Government investment (% of Expenditures)") + xlab("") +
  geom_image(data = . %>%
               filter(date == as.Date("2012-01-01")) %>%
               mutate(image = paste0("../../icon/flag/", str_to_lower(gsub(" ", "-", Cou)), ".png")),
             aes(x = date, y = obsValue/100, image = image), asp = 1.5) +
  scale_color_manual(values = c("#002395", "#000000")) +
  theme(legend.position = "none") +
  scale_x_date(breaks = seq(1920, 2025, 1) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%y")) +
  scale_y_continuous(breaks = 0.01*seq(-60, 60, 0.5),
                     labels = scales::percent_format(accuracy = .1))

v