SNA_TABLE10 %>%
filter(TRANSACT %in% c("D2D5D91"),
LOCATION %in% c("FRA", "DEU", "ITA"),
SECTOR == "TS13") %>%
left_join(SNA_TABLE1 %>%
filter(TRANSACT == "B1_GE",
MEASURE == "C") %>%
select(obsTime, LOCATION, B1_GE = obsValue),
by = c("LOCATION", "obsTime")) %>%
year_to_enddate %>%
left_join(SNA_TABLE10_var$LOCATION %>%
setNames(c("LOCATION", "LOCATION_desc")), by = "LOCATION") %>%
select(LOCATION_desc, date, TRANSACT, obsValue, B1_GE) %>%
group_by(LOCATION_desc) %>%
mutate(B1_GE_trend = log(B1_GE) %>% hpfilter(1000000) %>% pluck("trend") %>% exp,
obsValue = obsValue / B1_GE_trend) %>%
na.omit %>%
ggplot() + geom_line(aes(x = date, y = obsValue, color = LOCATION_desc, linetype = LOCATION_desc)) +
scale_color_manual(values = viridis(4)[1:3]) +
theme_minimal() +
scale_x_date(breaks = seq(1920, 2025, 2) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%y")) +
theme(legend.position = c(0.15, 0.9),
legend.title = element_blank()) +
scale_y_continuous(breaks = 0.01*seq(-10, 100, 1),
labels = scales::percent_format(accuracy = 1)) +
ylab("Taxes and social contrib. (% of trend GDP)") + xlab("")