Balance of payments
Data - OECD
Info
Last
obsTime | Nobs |
---|---|
2025-Q2 | 2273 |
REF_AREA
Code
%>%
BOP left_join(REF_AREA, by = "REF_AREA") %>%
group_by(REF_AREA, Ref_area) %>%
summarise(Nobs = n()) %>%
arrange(-Nobs) %>%
print_table_conditional()
FREQ
Code
%>%
BOP left_join(FREQ, by = "FREQ") %>%
group_by(FREQ, Freq) %>%
summarise(Nobs = n()) %>%
arrange(-Nobs) %>%
print_table_conditional()
FREQ | Freq | Nobs |
---|---|---|
Q | Quarterly | 614475 |
A | Annual | 151901 |
M | Monthly | 30576 |
ACCOUNTING_ENTRY
Code
%>%
BOP left_join(ACCOUNTING_ENTRY, by = "ACCOUNTING_ENTRY") %>%
group_by(ACCOUNTING_ENTRY, Accounting_entry) %>%
summarise(Nobs = n()) %>%
arrange(-Nobs) %>%
print_table_conditional()
ACCOUNTING_ENTRY | Accounting_entry | Nobs |
---|---|---|
C | Revenue | 207938 |
B | Balance (revenue minus expenditure) | 201583 |
D | Expenditure | 189324 |
N | Net (assets minus liabilities) | 79288 |
A | Assets (or net acquisition of assets) | 66306 |
L | Liabilities (or net incurrence of liabilities) | 52513 |
UNIT_MEASURE
Code
%>%
BOP left_join(UNIT_MEASURE, by = "UNIT_MEASURE") %>%
group_by(UNIT_MEASURE, Unit_measure) %>%
summarise(Nobs = n()) %>%
arrange(-Nobs) %>%
print_table_conditional()
UNIT_MEASURE | Unit_measure | Nobs |
---|---|---|
USD_EXC | US dollars, exchange rate converted | 442056 |
XDC | National currency | 316334 |
PT_GS | Percentage of goods and services | 15498 |
PT_CA | Percentage of current account | 15408 |
PT_B1GQ | Percentage of GDP | 7656 |
MEASURE
Code
%>%
BOP left_join(MEASURE, by = "MEASURE") %>%
group_by(MEASURE, Measure) %>%
summarise(Nobs = n()) %>%
arrange(-Nobs) %>%
print_table_conditional()
MEASURE | Measure | Nobs |
---|---|---|
S | Services | 118360 |
CA | Current account | 94972 |
G | Goods | 87225 |
IN1 | Primary income | 87001 |
IN2 | Secondary income | 86997 |
FA_D_F | Direct investment | 40140 |
FA | Financial account | 39999 |
FA_O_F | Other investment | 39464 |
KA | Capital account | 39271 |
FA_P_F | Portfolio investment | 39033 |
NP | Gross acquisitions / disposals of nonproduced nonfinancial assets | 25484 |
D9 | Capital transfers | 25202 |
G2 | Net exports of goods under merchanting | 15022 |
EO | Net errors and omissions | 13794 |
FA_R_F_S121 | Reserve assets | 13793 |
FA_F_F7 | Financial derivatives | 11884 |
G22 | Goods sold under merchanting | 9663 |
G21 | Goods acquired under merchanting | 9648 |
Financial account
EU vs. US vs. DE vs. FR
All
Code
%>%
BOP filter(MEASURE == "FA",
%in% c("USA", "EU27_2020", "DEU", "FRA"),
REF_AREA == "Q",
FREQ == "USD_EXC",
UNIT_MEASURE == "N") %>%
ACCOUNTING_ENTRY arrange(desc(obsTime)) %>%
quarter_to_date() %>%
left_join(REF_AREA, by = "REF_AREA") %>%
arrange(desc(date)) %>%
mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) %>%
left_join(colors, by = c("Ref_area" = "country")) %>%
mutate(color = ifelse(REF_AREA == "USA", color2, color)) %>%
mutate(obsValue = obsValue/100) %>%
#filter(date >= as.Date("1999-01-01")) %>%
rename(Location = Ref_area) %>%
#filter(date <= as.Date("2021-01-01")) %>%
ggplot(.) + geom_line(aes(x = date, y = obsValue, color = color)) +
theme_minimal() + xlab("") + ylab("Financial Account") +
scale_color_identity() + add_4flags +
scale_x_date(breaks = c(seq(1949, 2100, 5)) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = seq(-10000, 10000, 500)) +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
1999-
Code
%>%
BOP filter(MEASURE == "FA",
%in% c("USA", "EU27_2020", "DEU", "FRA"),
REF_AREA == "Q",
FREQ == "USD_EXC",
UNIT_MEASURE == "N") %>%
ACCOUNTING_ENTRY quarter_to_date() %>%
left_join(REF_AREA, by = "REF_AREA") %>%
arrange(desc(date)) %>%
mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) %>%
left_join(colors, by = c("Ref_area" = "country")) %>%
mutate(color = ifelse(REF_AREA == "USA", color2, color)) %>%
mutate(obsValue = obsValue/100) %>%
filter(date >= as.Date("1999-01-01")) %>%
rename(Location = Ref_area) %>%
#filter(date <= as.Date("2021-01-01")) %>%
ggplot(.) + geom_line(aes(x = date, y = obsValue, color = color)) +
theme_minimal() + xlab("") + ylab("Financial Account") +
scale_color_identity() + add_4flags +
scale_x_date(breaks = c(seq(1999, 2100, 5)) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = seq(-10000, 10000, 500)) +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
Current account (CA, % of GDP)
Greece, EU, US, France
1999-
Quarterly
Code
%>%
BOP filter(MEASURE == "CA",
%in% c("FRA", "GRC", "USA", "EU27_2020"),
REF_AREA == "Q",
FREQ == "PT_B1GQ") %>%
UNIT_MEASURE quarter_to_date() %>%
left_join(REF_AREA, by = "REF_AREA") %>%
arrange(desc(date)) %>%
mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) %>%
left_join(colors, by = c("Ref_area" = "country")) %>%
mutate(color = ifelse(REF_AREA == "USA", color2, color)) %>%
mutate(obsValue = obsValue/100) %>%
filter(date >= as.Date("1999-01-01")) %>%
rename(Location = Ref_area) %>%
#filter(date <= as.Date("2021-01-01")) %>%
ggplot(.) + geom_line(aes(x = date, y = obsValue, color = color)) +
theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
scale_color_identity() + add_2flags +
scale_x_date(breaks = c(seq(1990, 2100, 2)) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
labels = scales::percent_format(accuracy = 1)) +
geom_hline(yintercept = 0, linetype = "dashed", color = "black") +
geom_label(data = . %>% filter(date == max(date)),
aes(x = date, y = obsValue, label = percent(obsValue), color = color))
Smoothed
Code
%>%
BOP filter(MEASURE == "CA",
%in% c("FRA", "GRC", "USA", "EU27_2020"),
REF_AREA == "Q",
FREQ == "PT_B1GQ") %>%
UNIT_MEASURE quarter_to_date() %>%
left_join(REF_AREA, by = "REF_AREA") %>%
arrange(desc(date)) %>%
mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) %>%
left_join(colors, by = c("Ref_area" = "country")) %>%
mutate(color = ifelse(REF_AREA == "USA", color2, color)) %>%
mutate(obsValue = obsValue/100) %>%
group_by(REF_AREA) %>%
arrange(date) %>%
mutate(obsValue = zoo::rollmean(obsValue, k = 4, fill = NA, align = "right")) %>%
ungroup() %>%
filter(date >= as.Date("1999-01-01")) %>%
rename(Location = Ref_area) %>%
#filter(date <= as.Date("2021-01-01")) %>%
ggplot(.) + geom_line(aes(x = date, y = obsValue, color = color)) +
theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
scale_color_identity() + add_4flags +
scale_x_date(breaks = c(seq(1990, 2100, 2)) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
labels = scales::percent_format(accuracy = 1)) +
geom_hline(yintercept = 0, linetype = "dashed", color = "black") +
geom_label(data = . %>% filter(date == max(date)),
aes(x = date, y = obsValue, label = percent(obsValue), color = color))
2003-
Smoothed
Code
%>%
BOP filter(MEASURE == "CA",
%in% c("FRA", "GRC", "USA", "EU27_2020", "ITA"),
REF_AREA == "Q",
FREQ == "PT_B1GQ") %>%
UNIT_MEASURE quarter_to_date() %>%
left_join(REF_AREA, by = "REF_AREA") %>%
arrange(desc(date)) %>%
mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) %>%
left_join(colors, by = c("Ref_area" = "country")) %>%
mutate(color = ifelse(REF_AREA == "USA", color2, color)) %>%
mutate(obsValue = obsValue/100) %>%
group_by(REF_AREA) %>%
arrange(date) %>%
mutate(obsValue = zoo::rollmean(obsValue, k = 4, fill = NA, align = "right")) %>%
ungroup() %>%
filter(date >= as.Date("2003-01-01")) %>%
rename(Location = Ref_area) %>%
#filter(date <= as.Date("2021-01-01")) %>%
ggplot(.) + geom_line(aes(x = date, y = obsValue, color = color)) +
theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
scale_color_identity() + add_5flags +
scale_x_date(breaks = c(seq(1990, 2100, 2)) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
labels = scales::percent_format(accuracy = 1)) +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
Greece, US, France
1999-
Quarterly
Code
%>%
BOP filter(MEASURE == "CA",
%in% c("FRA", "GRC", "USA"),
REF_AREA == "Q",
FREQ == "PT_B1GQ") %>%
UNIT_MEASURE quarter_to_date() %>%
left_join(REF_AREA, by = "REF_AREA") %>%
arrange(desc(date)) %>%
mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) %>%
left_join(colors, by = c("Ref_area" = "country")) %>%
mutate(color = ifelse(REF_AREA == "USA", color2, color)) %>%
mutate(obsValue = obsValue/100) %>%
filter(date >= as.Date("1999-01-01")) %>%
rename(Location = Ref_area) %>%
#filter(date <= as.Date("2021-01-01")) %>%
ggplot(.) + geom_line(aes(x = date, y = obsValue, color = color)) +
theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
scale_color_identity() + add_2flags +
scale_x_date(breaks = c(seq(1990, 2100, 2)) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
labels = scales::percent_format(accuracy = 1)) +
geom_hline(yintercept = 0, linetype = "dashed", color = "black") +
geom_label(data = . %>% filter(date == max(date)),
aes(x = date, y = obsValue, label = percent(obsValue), color = color))
Smoothed
Code
%>%
BOP filter(MEASURE == "CA",
%in% c("FRA", "GRC", "USA"),
REF_AREA == "Q",
FREQ == "PT_B1GQ") %>%
UNIT_MEASURE quarter_to_date() %>%
left_join(REF_AREA, by = "REF_AREA") %>%
arrange(desc(date)) %>%
mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) %>%
left_join(colors, by = c("Ref_area" = "country")) %>%
mutate(color = ifelse(REF_AREA == "USA", color2, color)) %>%
mutate(obsValue = obsValue/100) %>%
group_by(REF_AREA) %>%
arrange(date) %>%
mutate(obsValue = zoo::rollmean(obsValue, k = 4, fill = NA, align = "right")) %>%
ungroup() %>%
filter(date >= as.Date("1999-01-01")) %>%
rename(Location = Ref_area) %>%
#filter(date <= as.Date("2021-01-01")) %>%
ggplot(.) + geom_line(aes(x = date, y = obsValue, color = color)) +
theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
scale_color_identity() + add_3flags +
scale_x_date(breaks = c(seq(1990, 2100, 2)) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
labels = scales::percent_format(accuracy = 1)) +
geom_hline(yintercept = 0, linetype = "dashed", color = "black") +
geom_label(data = . %>% filter(date == max(date)),
aes(x = date, y = obsValue, label = percent(obsValue), color = color))
EU vs. US
All
Code
%>%
BOP filter(MEASURE == "CA",
%in% c("USA", "EA20"),
REF_AREA == "Q",
FREQ == "PT_B1GQ") %>%
UNIT_MEASURE quarter_to_date() %>%
left_join(REF_AREA, by = "REF_AREA") %>%
arrange(desc(date)) %>%
mutate(Ref_area = ifelse(REF_AREA == "EA20", "Europe", Ref_area)) %>%
left_join(colors, by = c("Ref_area" = "country")) %>%
mutate(color = ifelse(REF_AREA == "USA", color2, color)) %>%
mutate(obsValue = obsValue/100) %>%
rename(Location = Ref_area) %>%
#filter(date <= as.Date("2021-01-01")) %>%
ggplot(.) + geom_line(aes(x = date, y = obsValue, color = color)) +
theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
scale_color_identity() + add_2flags +
scale_x_date(breaks = seq(1920, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
labels = scales::percent_format(accuracy = 1)) +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
2012-
Code
%>%
BOP filter(MEASURE == "CA",
%in% c("USA", "EA20"),
REF_AREA == "Q",
FREQ == "PT_B1GQ") %>%
UNIT_MEASURE quarter_to_date() %>%
left_join(REF_AREA, by = "REF_AREA") %>%
arrange(desc(date)) %>%
mutate(Ref_area = ifelse(REF_AREA == "EA20", "Europe", Ref_area)) %>%
left_join(colors, by = c("Ref_area" = "country")) %>%
mutate(color = ifelse(REF_AREA == "USA", color2, color)) %>%
mutate(obsValue = obsValue/100) %>%
rename(Location = Ref_area) %>%
filter(date >= as.Date("2013-01-01")) %>%
ggplot(.) + geom_line(aes(x = date, y = obsValue, color = color)) +
theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
scale_color_identity() + add_2flags +
scale_x_date(breaks = seq(1920, 2100, 1) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
labels = scales::percent_format(accuracy = 1)) +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
EU27_2020 vs. US
All
Code
%>%
BOP filter(MEASURE == "CA",
%in% c("USA", "EU27_2020"),
REF_AREA == "Q",
FREQ == "PT_B1GQ") %>%
UNIT_MEASURE quarter_to_date() %>%
left_join(REF_AREA, by = "REF_AREA") %>%
arrange(desc(date)) %>%
mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) %>%
left_join(colors, by = c("Ref_area" = "country")) %>%
mutate(color = ifelse(REF_AREA == "USA", color2, color)) %>%
mutate(obsValue = obsValue/100) %>%
rename(Location = Ref_area) %>%
#filter(date <= as.Date("2021-01-01")) %>%
ggplot(.) + geom_line(aes(x = date, y = obsValue, color = color)) +
theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
scale_color_identity() + add_2flags +
scale_x_date(breaks = seq(1920, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
labels = scales::percent_format(accuracy = 1)) +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
1999-
Code
%>%
BOP filter(MEASURE == "CA",
%in% c("USA", "EU27_2020"),
REF_AREA == "Q",
FREQ == "PT_B1GQ") %>%
UNIT_MEASURE quarter_to_date() %>%
left_join(REF_AREA, by = "REF_AREA") %>%
arrange(desc(date)) %>%
mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) %>%
left_join(colors, by = c("Ref_area" = "country")) %>%
mutate(color = ifelse(REF_AREA == "USA", color2, color)) %>%
mutate(obsValue = obsValue/100) %>%
filter(date >= as.Date("1999-01-01")) %>%
rename(Location = Ref_area) %>%
#filter(date <= as.Date("2021-01-01")) %>%
ggplot(.) + geom_line(aes(x = date, y = obsValue, color = color)) +
theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
scale_color_identity() + add_2flags +
scale_x_date(breaks = c(seq(1990, 2100, 2)) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
labels = scales::percent_format(accuracy = 1)) +
geom_hline(yintercept = 0, linetype = "dashed", color = "black") +
geom_label(data = . %>% filter(date == max(date)),
aes(x = date, y = obsValue, label = percent(obsValue), color = color))
EU vs. US vs. IT
1999-
Code
%>%
BOP filter(MEASURE == "CA",
%in% c("USA", "EU27_2020", "ITA"),
REF_AREA == "Q",
FREQ == "PT_B1GQ") %>%
UNIT_MEASURE quarter_to_date() %>%
left_join(REF_AREA, by = "REF_AREA") %>%
arrange(desc(date)) %>%
mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) %>%
left_join(colors, by = c("Ref_area" = "country")) %>%
mutate(color = ifelse(REF_AREA == "USA", color2, color)) %>%
mutate(obsValue = obsValue/100) %>%
filter(date >= as.Date("1999-01-01")) %>%
rename(Location = Ref_area) %>%
#filter(date <= as.Date("2021-01-01")) %>%
ggplot(.) + geom_line(aes(x = date, y = obsValue, color = color)) +
theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
scale_color_identity() + add_3flags +
scale_x_date(breaks = c(seq(1997, 2100, 5), seq(1999, 2100, 5)) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
labels = scales::percent_format(accuracy = 1)) +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
EU vs. US vs. DE vs. FR
All
Code
%>%
BOP filter(MEASURE == "CA",
%in% c("USA", "EU27_2020", "DEU", "FRA"),
REF_AREA == "Q",
FREQ == "PT_B1GQ") %>%
UNIT_MEASURE quarter_to_date() %>%
left_join(REF_AREA, by = "REF_AREA") %>%
arrange(desc(date)) %>%
mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) %>%
left_join(colors, by = c("Ref_area" = "country")) %>%
mutate(color = ifelse(REF_AREA == "USA", color2, color)) %>%
mutate(obsValue = obsValue/100) %>%
#filter(date >= as.Date("1999-01-01")) %>%
rename(Location = Ref_area) %>%
#filter(date <= as.Date("2021-01-01")) %>%
ggplot(.) + geom_line(aes(x = date, y = obsValue, color = color)) +
theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
scale_color_identity() + add_4flags +
scale_x_date(breaks = c(seq(1949, 2100, 5)) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
labels = scales::percent_format(accuracy = 1)) +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
1999-
Quarterly
Code
%>%
BOP filter(MEASURE == "CA",
%in% c("USA", "EU27_2020", "DEU", "FRA"),
REF_AREA == "Q",
FREQ == "PT_B1GQ") %>%
UNIT_MEASURE quarter_to_date() %>%
left_join(REF_AREA, by = "REF_AREA") %>%
arrange(desc(date)) %>%
mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) %>%
left_join(colors, by = c("Ref_area" = "country")) %>%
mutate(color = ifelse(REF_AREA == "USA", color2, color)) %>%
mutate(obsValue = obsValue/100) %>%
filter(date >= as.Date("1999-01-01")) %>%
rename(Location = Ref_area) %>%
#filter(date <= as.Date("2021-01-01")) %>%
ggplot(.) + geom_line(aes(x = date, y = obsValue, color = color)) +
theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
scale_color_identity() + add_4flags +
scale_x_date(breaks = c(seq(1997, 2100, 2)) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
labels = scales::percent_format(accuracy = 1)) +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
Smoothed
Quarterly
Code
%>%
BOP filter(MEASURE == "CA",
%in% c("USA", "EU27_2020", "DEU", "FRA"),
REF_AREA == "Q",
FREQ == "PT_B1GQ") %>%
UNIT_MEASURE quarter_to_date() %>%
left_join(REF_AREA, by = "REF_AREA") %>%
arrange(desc(date)) %>%
mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) %>%
left_join(colors, by = c("Ref_area" = "country")) %>%
mutate(color = ifelse(REF_AREA == "USA", color2, color)) %>%
mutate(obsValue = obsValue/100) %>%
filter(date >= as.Date("1999-01-01")) %>%
group_by(REF_AREA) %>%
arrange(date) %>%
mutate(obsValue_roll4 = zoo::rollmean(obsValue, k = 4, fill = NA, align = "right")) %>%
ungroup() %>%
rename(Location = Ref_area) %>%
#filter(date <= as.Date("2021-01-01")) %>%
ggplot(.) + geom_line(aes(x = date, y = obsValue_roll4, color = color)) +
theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
scale_color_identity() + add_4flags +
scale_x_date(breaks = c(seq(1997, 2100, 2)) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
labels = scales::percent_format(accuracy = 1)) +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
EU vs. US vs. DE
All
Code
%>%
BOP filter(MEASURE == "CA",
%in% c("USA", "EU27_2020", "DEU"),
REF_AREA == "Q",
FREQ == "PT_B1GQ") %>%
UNIT_MEASURE quarter_to_date() %>%
left_join(REF_AREA, by = "REF_AREA") %>%
arrange(desc(date)) %>%
mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) %>%
left_join(colors, by = c("Ref_area" = "country")) %>%
mutate(color = ifelse(REF_AREA == "USA", color2, color)) %>%
mutate(obsValue = obsValue/100) %>%
#filter(date >= as.Date("1999-01-01")) %>%
rename(Location = Ref_area) %>%
#filter(date <= as.Date("2021-01-01")) %>%
ggplot(.) + geom_line(aes(x = date, y = obsValue, color = color)) +
theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
scale_color_identity() + add_4flags +
scale_x_date(breaks = c(seq(1949, 2100, 5)) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
labels = scales::percent_format(accuracy = 1)) +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
1999-
Code
%>%
BOP filter(MEASURE == "CA",
%in% c("USA", "EU27_2020", "DEU"),
REF_AREA == "Q",
FREQ == "PT_B1GQ") %>%
UNIT_MEASURE quarter_to_date() %>%
left_join(REF_AREA, by = "REF_AREA") %>%
arrange(desc(date)) %>%
mutate(Ref_area = ifelse(REF_AREA == "EU27_2020", "Europe", Ref_area)) %>%
left_join(colors, by = c("Ref_area" = "country")) %>%
mutate(color = ifelse(REF_AREA == "USA", color2, color)) %>%
mutate(obsValue = obsValue/100) %>%
filter(date >= as.Date("1999-01-01")) %>%
rename(Location = Ref_area) %>%
#filter(date <= as.Date("2021-01-01")) %>%
ggplot(.) + geom_line(aes(x = date, y = obsValue, color = color)) +
theme_minimal() + xlab("") + ylab("Current Account, % of GDP") +
scale_color_identity() + add_3flags +
scale_x_date(breaks = c(seq(1997, 2100, 5), seq(1999, 2100, 5)) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-60, 60, 1),
labels = scales::percent_format(accuracy = 1)) +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")