Balance of payments by country - monthly data (BPM6) - bop_c6_m

Data - Eurostat

Structure

Germany, France, Italy

CA

Code
bop_c6_m |>
  filter(geo %in% c("DE", "FR", "IT"),
         stk_flow == "BAL",
         currency == "MIO_EUR",
         partner == "WRL_REST",
         bop_item == "CA") |>
  month_to_date() |>
  
  left_join(B1GQ, by = c("geo", "date")) |>
  group_by(Geo) |>
  arrange(date) |>
  mutate(B1GQ_i = spline(x = date, y = B1GQ, xout = date)$y,
         values = 3*values / B1GQ_i) |>
  add_flag_color("Geo") |>
  ggplot() + geom_line(aes(x = date, y = values, color = color)) +
  scale_color_identity() + add_flags +
  scale_color_manual(values = c("#002395", "#000000", "#009246")) +
  theme_minimal()  +
  scale_x_date(breaks = as.Date(paste0(seq(1960, 2100, 5), "-01-01")),
               labels = date_format("%Y")) +
  geom_image(data = . %>%
               filter(date == as.Date("2008-01-01")) %>%
               mutate(image = paste0("../../icon/flag/", str_to_lower(Geo), ".png")),
             aes(x = date, y = values, image = image), asp = 1.5) +
  theme(legend.position = "none") +
  xlab("") + ylab("") +
  scale_y_continuous(breaks = 0.01*seq(-30, 30, 1),
                labels = percent_format(a = 1)) + 
  geom_hline(yintercept = 0, linetype = "dashed",  color = "black")

KA

Code
bop_c6_m |>
  filter(geo %in% c("DE", "FR", "IT"),
         stk_flow == "BAL",
         currency == "MIO_EUR",
         partner == "WRL_REST",
         bop_item == "KA") |>
  month_to_date() |>
  
  left_join(B1GQ, by = c("geo", "date")) |>
  group_by(Geo) |>
  arrange(date) |>
  mutate(B1GQ_i = spline(x = date, y = B1GQ, xout = date)$y,
         values = 3*values / B1GQ_i) |>
  add_flag_color("Geo") |>
  ggplot() + geom_line(aes(x = date, y = values, color = color)) +
  scale_color_identity() + add_flags +
  scale_color_manual(values = c("#002395", "#000000", "#009246")) +
  theme_minimal()  +
  scale_x_date(breaks = as.Date(paste0(seq(1960, 2100, 5), "-01-01")),
               labels = date_format("%Y")) +
  geom_image(data = . %>%
               filter(date == as.Date("2008-01-01")) %>%
               mutate(image = paste0("../../icon/flag/", str_to_lower(Geo), ".png")),
             aes(x = date, y = values, image = image), asp = 1.5) +
  theme(legend.position = "none") +
  xlab("") + ylab("") +
  scale_y_continuous(breaks = 0.01*seq(-30, 30, 1),
                labels = percent_format(a = 1)) + 
  geom_hline(yintercept = 0, linetype = "dashed",  color = "black")

FA

Code
bop_c6_m |>
  filter(geo %in% c("DE", "FR", "IT"),
         stk_flow == "NET",
         currency == "MIO_EUR",
         partner == "WRL_REST",
         bop_item == "FA") |>
  month_to_date() |>

  left_join(B1GQ, by = c("geo", "date")) |>
  group_by(Geo) |>
  arrange(date) |>
  mutate(B1GQ_i = spline(x = date, y = B1GQ, xout = date)$y,
         values = 3*values / B1GQ_i) |>
  add_flag_color("Geo") |>
  ggplot() + geom_line(aes(x = date, y = values, color = color)) +
  scale_color_identity() + add_flags +
  scale_color_manual(values = c("#002395", "#000000", "#009246")) +
  theme_minimal()  +
  scale_x_date(breaks = as.Date(paste0(seq(1960, 2100, 5), "-01-01")),
               labels = date_format("%Y")) +
  geom_image(data = . %>%
               filter(date == as.Date("2008-01-01")) %>%
               mutate(image = paste0("../../icon/flag/", str_to_lower(Geo), ".png")),
             aes(x = date, y = values, image = image), asp = 1.5) +
  theme(legend.position = "none") +
  xlab("") + ylab("") +
  scale_y_continuous(breaks = 0.01*seq(-30, 30, 2),
                labels = percent_format(a = 1)) +
  geom_hline(yintercept = 0, linetype = "dashed",  color = "black")

Current Account: Country Comparison

Latest Month, by Item

Code
latest_m <- bop_c6_m |>
  filter(bop_item == "CA",
         stk_flow == "BAL",
         partner == "WRL_REST",
         sector10 == "S1",
         sectpart == "S1",
         currency == "MIO_EUR",
         geo %in% c("DE", "FR", "IT", "ES", "NL", "BE", "PT", "IE"),
         !is.na(values)) |>
  summarise(m = max(time)) |>
  pull(m)

bop_c6_m |>
  filter(geo %in% c("DE", "FR", "IT", "ES", "NL", "BE", "PT", "IE"),
         stk_flow == "BAL",
         partner == "WRL_REST",
         sector10 == "S1",
         sectpart == "S1",
         currency == "MIO_EUR",
         bop_item %in% c("CA", "KA", "FA", "G", "S", "GS", "IN1", "IN2"),
         time == latest_m) |>
  mutate(values = values/1000) |>
  select(bop_item, Bop_item, Geo, values) |>
  spread(Geo, values) |>
  print_table_conditional()
bop_item Bop_item Belgium France Germany Ireland Italy Netherlands Portugal Spain
CA Current account -1.419 -6.812 10.320 NA 2.766 NA 1.420 NA
G Goods -1.160 -6.703 13.063 NA 2.280 NA -2.772 NA
GS Goods and services -1.639 -2.479 1.551 NA 2.913 NA 1.509 NA
IN1 Primary income 0.982 1.052 15.592 NA 1.799 NA -0.563 NA
IN2 Secondary income -0.762 -5.386 -6.823 NA -1.946 NA 0.475 NA
KA Capital account -0.538 0.505 -1.423 NA 0.187 NA 0.233 NA
S Services -0.478 4.224 -11.512 NA 0.633 NA 4.280 NA

By Destination: Europe, ex-Europe

France

Code
bop_c6_m |>
  filter(geo == "FR",
         stk_flow == "BAL",
         time == "2021M04",
         currency == "MIO_EUR",
         partner %in% c("EA19", "EXT_EA19", "WRL_REST")) |>

  select(bop_item, Bop_item, everything()) %>%
  select_if(~n_distinct(.) > 1) |>
  spread(partner, values) |>
  arrange(sector10) |>
  print_table_conditional()

Germany

Code
bop_c6_m |>
  filter(geo == "DE",
         stk_flow == "BAL",
         time == "2021M04",
         currency == "MIO_EUR",
         partner %in% c("EA19", "EXT_EA19", "WRL_REST")) |>

  select(bop_item, Bop_item, everything()) %>%
  select_if(~n_distinct(.) > 1) |>
  spread(partner, values) |>
  arrange(sector10) |>
  print_table_conditional()

By Destination: Europe, ex-Europe

France

Code
bop_c6_m |>
  filter(geo == "FR",
         stk_flow == "BAL",
         time == "2021M04",
         currency == "MIO_EUR",
         partner %in% c("EA19", "EXT_EA19", "WRL_REST")) |>
  
  select(bop_item, Bop_item, everything()) %>%
  select_if(~n_distinct(.) > 1) |>
  spread(partner, values) |>
  arrange(sector10) |>
  print_table_conditional()

Germany

Code
bop_c6_m |>
  filter(geo == "DE",
         stk_flow == "BAL",
         time == "2021M04",
         currency == "MIO_EUR",
         partner %in% c("EA19", "EXT_EA19", "WRL_REST")) |>
  
  select(bop_item, Bop_item, everything()) %>%
  select_if(~n_distinct(.) > 1) |>
  spread(partner, values) |>
  arrange(sector10) |>
  print_table_conditional()