load_data("insee/INDICE-TRAITEMENT-FP-net-brut-mensuel.RData")
data2 <- indicefp %>%
select(date, point_indice_en_euros) %>%
arrange(desc(date)) %>%
gather(variable, value, -date) %>%
group_by(variable) %>%
complete(date = seq.Date(min(date), max(date), by = "day")) %>%
fill(value) %>%
ungroup %>%
left_join(cpi2_m, by = "date") %>%
filter(day(date) == 1) %>%
left_join(net_brut_mensuel, by = "date") %>%
filter(date >= as.Date("1999-01-01")) %>%
transmute(date,
`IPCH, Eurostat` = (value/value[1])*(cpih[1]/cpih)*(net_brut/net_brut[1]),
`IPC, INSEE` = (value/value[1])*(cpi[1]/cpi)*(net_brut/net_brut[1])) %>%
gather(type, OBS_VALUE, -date) %>%
mutate(variable = "Point d'Indice de la Fonction Publique vs. 1999")
data2 %>%
ggplot() + geom_line(aes(x = date, y = OBS_VALUE, linetype = type)) + theme_minimal() +
scale_x_date(breaks = c(seq(1999, 2100, 5), seq(1997, 2100, 5)) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
theme(legend.position = c(0.43, 0.12),
legend.title = element_blank()) +
scale_y_log10(breaks = seq(1, 0.02, -0.02),
labels = percent(seq(1, 0.02, -0.02)-1, acc = 1)) +
ylab("Point Indice Fonction Publique vs. 1999") + xlab("") +
geom_text(data = . %>% filter(year(date) %in% seq(1999, 2040, 5),
month(date) == 1),
aes(x = date, y = OBS_VALUE, label = percent(OBS_VALUE-1, acc = 0.1)),
fontface ="bold", color = "black", size = 3)