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.760 3.540 19.034 NA 5.839 NA -0.303 NA
G Goods 2.303 -4.778 17.348 NA 4.852 NA -3.109 NA
GS Goods and services 0.886 3.832 10.125 NA 6.392 NA -0.310 NA
IN1 Primary income 1.377 4.128 13.901 NA 0.735 NA -0.428 NA
IN2 Secondary income -0.504 -4.419 -4.992 NA -1.289 NA 0.435 NA
KA Capital account 0.078 0.309 -3.455 NA 0.728 NA 0.652 NA
S Services -1.417 8.610 -7.222 NA 1.539 NA 2.799 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()