knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.height = 7, fig.width = 16, fig.path = "UCL_tot/", echo = FALSE, message = FALSE, warning = FALSE )
# install.packages("ameco") devtools::load_all() library(dplyr) library(ameco) library(tidyr) library(ggplot2) library(ggptt) set_proj_theme(20)
# separate codes ameco2 <- ameco %>% tidyr::separate(code, into = c("country_code", NA, NA, NA, NA, "title_code"), sep = "\\.")
ameco2 %>% distinct(title_code, title) %>% # filter(grepl("djuste", title)) %>% knitr::kable()
gdb_tot_series <- c("OVGDA", "OVGD", "UXGS", "PMGS", "OXGS") fi_dat <- ameco2 %>% filter(country_code == "FIN", title_code %in% gdb_tot_series, !grepl("ECU", unit)) # only EURO-national currency series fi_dat %>% select(title_code, title, unit) %>% distinct() %>% knitr::kable()
fi_dat2 <- fi_dat %>% select(title_code, year, value) %>% spread(title_code, value) %>% mutate(OVGDA2 = ((OVGD + UXGS/(PMGS/100) - OXGS) / OVGD[year == 2010]) * 100, OVGDA3 = (OVGD + UXGS/(PMGS/100) - OXGS), ovgd_10 = (OVGD / OVGD[year == 2010] * 100))
fi_dat2 %>% gather(vars, value, - year) %>% filter(vars %in% c("OVGDA2", "OVGDA", "ovgd_10")) %>% ggplot(aes(year, value, colour = vars)) + geom_line()
fi_dat2 %>% gather(vars, value, - year) %>% filter(vars %in% c("OVGDA3", "OVGD")) %>% ggplot(aes(year, value, colour = vars)) + geom_line()
ameco2 %>% filter(title_code %in% c("UWCD", "OVGD", "OVGDA", "NWTD", "NETD"), country_code %in% c("FIN", "SWE", "DEU", "FRA"), !grepl("ECU", unit), !grepl("PPS", unit), year > 1989) %>% # only EURO-national currency series select(country_code ,title_code, year, value) %>% spread(title_code, value) %>% group_by(country_code) %>% mutate(nulc_per = rebase((UWCD / NWTD) / (OVGD / NETD), year, 2010), nulc_per_tota = rebase((UWCD / NWTD) / (OVGDA / NETD), year, 2010)) %>% ungroup() %>% select(country_code, year, nulc_per, nulc_per_tota) %>% gather(vars, values, nulc_per, nulc_per_tota) %>% ggplot(aes(year, values, colour = vars)) + facet_wrap(~ country_code) + geom_line() + the_title_blank()
data_ameco %>% group_by(geo) %>% mutate(B1GA2 = 100 * (B1GQ__CLV15_MNAC + (P6__CP_MNAC / (P7__CP_MNAC / P7__CLV15_MNAC)) - P6__CLV15_MNAC) / B1GQ__CLV15_MNAC[time == 2015]) %>% ungroup() %>% filter(geo %in% c("FI", "US", "SE", "DE")) %>% select(geo, time, B1GQA__CLV15_MNAC, B1GA2) %>% gather(vars, values, -geo, -time) %>% ggplot(aes(time, values, colour = vars)) + geom_line() + facet_wrap(~geo)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.