knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>", 
  fig.height = 7,
  fig.width = 16,
  fig.path = "Report2/", 
  echo = FALSE, message = FALSE, warning = FALSE
)


# library(ficomp)

devtools::load_all()

library(dplyr)
library(forcats)
library(ggplot2)
library(eurostat)
library(tidyr)
library(ggptt)

set_proj_theme(22)

data(q_dat, a_dat, naq_eurostat_dat)

base_year <- 2010
base_years <- 2000:2018
geos <- c(Finland = "FI", Sweden = "SE", Germany = "DE", France = "FR")
start_time <- "1995-01-01"



data(data_main_groups_a, data_main_total_a, eo_a_dat)

data_a_joined <- data_main_groups_a %>% 
  left_join(data_main_total_a)

Nimelliset yksikkötyökustannukset


Economic outlook

eo_a_dat %>% 
  filter(geo %in% c("FI", "DE", "FR", "IT")) %>% 
  select(geo, time, nulc_rel, gdp_ind_rel15, exp_ind_rel15, XPERF, XSHA, tbalance_gdp) %>% 
  group_by(geo) %>% 
  mutate(inv_nulc_rel = rebase(1/nulc_rel, time, base_year),
         xperf = rebase(XPERF, time, base_year),
         xsha = rebase(XSHA, time, base_year),
         tbalance_gdp_ind = rebase(0.5+tbalance_gdp, time, base_year)) %>% 
  ungroup() %>% 
  select(-nulc_rel, -XPERF, -XSHA, -tbalance_gdp) %>% 
  gather(vars, values, -geo, -time) %>% 
  # mutate(h_geo = fct_other(geo, keep = h_geos,other_level = "muut"),
  #        geo = fct_relevel(geo, h_geos, after = Inf)) %>% 
  ggplot(aes(time, values, colour = vars)) +
  geom_line() +
  facet_wrap(~ geo, scales = "free") +
  scale_size_manual(values = c(2,1)) +
  the_title_blank()

National account, Eurostat and OECD

data_a_joined %>% 
  filter(geo %in% c("FI", "DE", "FR", "IT"),
         nace0 == "total") %>% 
  select(geo, time, nulc_rel = nulc_hw_va_rel15, gdp_ind_rel15, exp_ind_rel15, XPERF, XSHA) %>% 
  group_by(geo) %>% 
  mutate(inv_nulc_rel = rebase(1/nulc_rel, time, base_year),
         xperf = rebase(XPERF, time, base_year),
         xsha = rebase(XSHA, time, base_year)) %>% 
  ungroup() %>% 
  select(-nulc_rel, -XPERF, -XSHA) %>% 
  gather(vars, values, -geo, -time) %>% 
  # mutate(h_geo = fct_other(geo, keep = h_geos,other_level = "muut"),
  #        geo = fct_relevel(geo, h_geos, after = Inf)) %>% 
  ggplot(aes(time, values, colour = vars)) +
  geom_line() +
  facet_wrap(~ geo, scales = "free") +
  scale_size_manual(values = c(2,1)) +
  the_title_blank()

Industry groups

data_a_joined %>% 
  filter(geo %in% c("FI", "DE", "FR", "IT")) %>% 
  select(geo, time, nace0, values = nulc_hw_va_rel15) %>% 
  ggplot(aes(time, values, colour = nace0)) +
  geom_line() +
  facet_wrap( ~ geo, scales = "free") +
  scale_size_manual(values = c(2,1)) +
  the_title_blank()
data_a_joined %>% 
  filter(geo %in% c("FI", "DE", "FR", "IT"), nace0 == "total") %>% 
  select(geo, time, nace0, nulc_hw_va_rel15, nulc_hw_va_eur_rel15, rulc_hw_va_rel15) %>% 
  gather(vars, values, -geo, -time, -nace0) %>% 
  # mutate(h_geo = fct_other(geo, keep = h_geos,other_level = "muut"),
  #        geo = fct_relevel(geo, h_geos, after = Inf)) %>% 
  ggplot(aes(time, values, colour = vars)) +
  geom_line() +
  facet_grid(nace0 ~ geo, scales = "free") +
  scale_size_manual(values = c(2,1)) +
  the_title_blank()


pttry/ficomp documentation built on June 11, 2024, 9:53 p.m.