Code
tibble(DOWNLOAD_TIME = as.Date(file.info("~/Library/Mobile\ Documents/com~apple~CloudDocs/website/data/imf/DOT_FR.RData")$mtime)) %>%
print_table_conditional()
DOWNLOAD_TIME |
---|
2024-06-08 |
Data - IMF
tibble(DOWNLOAD_TIME = as.Date(file.info("~/Library/Mobile\ Documents/com~apple~CloudDocs/website/data/imf/DOT_FR.RData")$mtime)) %>%
print_table_conditional()
DOWNLOAD_TIME |
---|
2024-06-08 |
%>%
DOT_FR group_by(TIME_PERIOD) %>%
summarise(Nobs = n()) %>%
arrange(desc(TIME_PERIOD)) %>%
head(1) %>%
print_table_conditional()
TIME_PERIOD | Nobs |
---|---|
2024-02 | 663 |
%>%
DOT_datasets mutate(html = paste0('<a target=_blank href=', id, '.html > html </a>')) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .} {
%>%
DOT_datasets mutate(html = paste0("[html](", id, '.html)')) %>%
if (is_html_output()) print_table(.) else .} {
id | title | html |
---|---|---|
DOT_FR | DOT - France | [html] |
DOT_DE | DOT - Germany | [html] |
%>%
DOT_DE bind_rows(DOT_FR) %>%
left_join(FREQ, by = "FREQ") %>%
group_by(FREQ, Freq) %>%
summarise(Nobs = n()) %>%
arrange(-Nobs) %>%
if (is_html_output()) print_table(.) else .} {
FREQ | Freq | Nobs |
---|---|---|
M | Monthly | 849164 |
Q | Quarterly | 292778 |
A | Annual | 82570 |
%>%
DOT_DE bind_rows(DOT_FR) %>%
left_join(INDICATOR, by = "INDICATOR") %>%
group_by(INDICATOR, Indicator) %>%
summarise(Nobs = n()) %>%
arrange(-Nobs) %>%
if (is_html_output()) print_table(.) else .} {
INDICATOR | Indicator | Nobs |
---|---|---|
TBG_USD | Goods, Value of Trade Balance, US Dollars | 419316 |
TXG_FOB_USD | Goods, Value of Exports, Free on board (FOB), US Dollars | 412465 |
TMG_CIF_USD | Goods, Value of Imports, Cost, Insurance, Freight (CIF), US Dollars | 392731 |
%>%
DOT_DE bind_rows(DOT_FR) %>%
left_join(REF_AREA, by = "REF_AREA") %>%
group_by(REF_AREA, Ref_area) %>%
summarise(Nobs = n()) %>%
arrange(-Nobs) %>%
mutate(Flag = gsub(" ", "-", str_to_lower(gsub(" ", "-", Ref_area))),
Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) %>%
select(Flag, everything()) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .} {
%>%
DOT_DE bind_rows(DOT_FR) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
group_by(COUNTERPART_AREA, Counterpart_area) %>%
summarise(Nobs = n()) %>%
arrange(-Nobs) %>%
mutate(Flag = gsub(" ", "-", str_to_lower(gsub(" ", "-", Counterpart_area))),
Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) %>%
select(Flag, everything()) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .} {
%>%
DOT_CN filter(TIME_PERIOD %in% c("2019", "2013", "2010", "2007", "2004"),
== "TBG_USD") %>%
INDICATOR mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
select(COUNTERPART_AREA, Counterpart_area, TIME_PERIOD, OBS_VALUE) %>%
spread(TIME_PERIOD, OBS_VALUE) %>%
arrange(-`2019`) %>%
mutate_at(vars(-1, -2), funs(paste0("$ ", round(./10^9), " Bn"))) %>%
mutate(Flag = gsub(" ", "-", str_to_lower(gsub(" ", "-", Counterpart_area))),
Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) %>%
select(Flag, everything()) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .} {
%>%
DOT_CN left_join(NGDP_USD %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
filter(TIME_PERIOD %in% c("2019", "2013", "2010", "2007", "2004"),
== "TBG_USD") %>%
INDICATOR mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
select(COUNTERPART_AREA, Counterpart_area, TIME_PERIOD, OBS_VALUE) %>%
spread(TIME_PERIOD, OBS_VALUE) %>%
arrange(-`2019`) %>%
mutate_at(vars(-1, -2), funs(round(100*., 2))) %>%
mutate(Flag = gsub(" ", "-", str_to_lower(gsub(" ", "-", Counterpart_area))),
Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) %>%
select(Flag, everything()) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .} {
%>%
DOT_CN left_join(NGDP_USD %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
filter(TIME_PERIOD %in% c("2019", "2013", "2010", "2007", "2004"),
== "TMG_CIF_USD") %>%
INDICATOR mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
select(COUNTERPART_AREA, Counterpart_area, TIME_PERIOD, OBS_VALUE) %>%
spread(TIME_PERIOD, OBS_VALUE) %>%
arrange(-`2019`) %>%
mutate_at(vars(-1, -2), funs(paste0(round(100*., 2), " %"))) %>%
mutate(Flag = gsub(" ", "-", str_to_lower(gsub(" ", "-", Counterpart_area))),
Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) %>%
select(Flag, everything()) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .} {
%>%
DOT_CN left_join(NGDP_USD %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
filter(TIME_PERIOD %in% c("2019", "2013", "2010", "2007", "2004"),
== "TXG_FOB_USD") %>%
INDICATOR mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
select(COUNTERPART_AREA, Counterpart_area, TIME_PERIOD, OBS_VALUE) %>%
spread(TIME_PERIOD, OBS_VALUE) %>%
arrange(-`2019`) %>%
mutate_at(vars(-1, -2), funs(paste0(round(100*., 2), " %"))) %>%
mutate(Flag = gsub(" ", "-", str_to_lower(gsub(" ", "-", Counterpart_area))),
Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) %>%
select(Flag, everything()) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .} {
%>%
DOT_CN filter(COUNTERPART_AREA %in% c("CN", "US", "E1", "FR"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 filter(date >= as.Date("1991-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
left_join(colors, by = c("Counterpart_area" = "country")) %>%
mutate(color = ifelse(COUNTERPART_AREA == "US", color2, color),
color = ifelse(COUNTERPART_AREA == "E1", color2, color)) %>%
ggplot(.) + theme_minimal() + scale_color_identity() + add_3flags +
geom_line(aes(x = date, y = OBS_VALUE, color = color)) +
scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .5),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("China Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_CN filter(COUNTERPART_AREA %in% c("DE", "US"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 filter(date >= as.Date("1991-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
ggplot(.) + theme_minimal() +
scale_color_manual(values = c("#FFDC00", "#003399", "#000000", "#B22234")) +
geom_line(aes(x = date, y = OBS_VALUE, color = Counterpart_area)) +
theme(legend.position = "none") + add_2flags +
scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .5),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("China Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_CN filter(COUNTERPART_AREA %in% c("FR", "IT", "DE", "ES"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 filter(date >= as.Date("1991-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
left_join(colors, by = c("Counterpart_area" = "country")) %>%
ggplot(.) + theme_minimal() + scale_color_identity() + add_4flags +
geom_line(aes(x = date, y = OBS_VALUE, color = color)) +
scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .05),
labels = percent_format(accuracy = .01)) +
xlab("") + ylab("China Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_GB filter(TIME_PERIOD %in% c("2019", "2013", "2010", "2007", "2004"),
== "TBG_USD") %>%
INDICATOR mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
select(COUNTERPART_AREA, Counterpart_area, TIME_PERIOD, OBS_VALUE) %>%
spread(TIME_PERIOD, OBS_VALUE) %>%
arrange(-`2019`) %>%
mutate_at(vars(-1, -2), funs(paste0("$ ", round(./10^9), " Bn"))) %>%
mutate(Flag = gsub(" ", "-", str_to_lower(gsub(" ", "-", Counterpart_area))),
Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) %>%
select(Flag, everything()) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .} {
%>%
DOT_GB left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
filter(TIME_PERIOD %in% c("2019", "2013", "2010", "2007", "2004"),
== "TBG_USD") %>%
INDICATOR mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
select(COUNTERPART_AREA, Counterpart_area, TIME_PERIOD, OBS_VALUE) %>%
spread(TIME_PERIOD, OBS_VALUE) %>%
arrange(-`2019`) %>%
mutate_at(vars(-1, -2), funs(round(100*., 2))) %>%
mutate(Flag = gsub(" ", "-", str_to_lower(gsub(" ", "-", Counterpart_area))),
Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) %>%
select(Flag, everything()) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .} {
%>%
DOT_GB filter(COUNTERPART_AREA %in% c("CN", "US", "E1", "FR"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 filter(date >= as.Date("1991-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
ggplot(.) + theme_minimal() +
scale_color_manual(values = c("#FFDC00", "#003399", "#000000", "#B22234")) +
geom_line(aes(x = date, y = OBS_VALUE, color = Counterpart_area)) +
theme(legend.position = "none") +
+
add_4flags scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .2),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("United Kingom Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_GB filter(COUNTERPART_AREA %in% c("DE", "SE", "CH"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 filter(date >= as.Date("1991-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
ggplot(.) + theme_minimal() +
scale_color_manual(values = c("#000000", "#FF0000", "#6E82B5")) +
geom_line(aes(x = date, y = OBS_VALUE, color = Counterpart_area)) +
theme(legend.position = "none") +
+
add_3flags scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .2),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("United Kingdom Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_GB filter(COUNTERPART_AREA %in% c("TR", "AE", "AU"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 filter(date >= as.Date("1991-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
ggplot(.) + theme_minimal() +
geom_line(aes(x = date, y = OBS_VALUE, color = Counterpart_area)) +
theme(legend.position = "none") +
scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .1),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("United Kingdom Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_GB filter(COUNTERPART_AREA %in% c("ES", "IT", "FR", "DE"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 filter(date >= as.Date("1991-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
ggplot(.) + theme_minimal() +
scale_color_manual(values = c("#0D5EAF", "#000000", "#009246", "#FFC400")) +
geom_line(aes(x = date, y = OBS_VALUE, color = Counterpart_area)) +
theme(legend.position = "none") +
+
add_4flags scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .2),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("United Kingdom Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_DE filter(TIME_PERIOD %in% c("2019", "2013", "2010", "2007", "2004"),
== "TBG_USD") %>%
INDICATOR mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
select(COUNTERPART_AREA, Counterpart_area, TIME_PERIOD, OBS_VALUE) %>%
spread(TIME_PERIOD, OBS_VALUE) %>%
arrange(-`2019`) %>%
mutate_at(vars(-1, -2), funs(paste0("$ ", round(./10^9), " Bn"))) %>%
mutate(Flag = gsub(" ", "-", str_to_lower(gsub(" ", "-", Counterpart_area))),
Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) %>%
select(Flag, everything()) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .} {
%>%
DOT_DE left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
filter(INDICATOR == "TBG_USD") %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
select(COUNTERPART_AREA, Counterpart_area, TIME_PERIOD, OBS_VALUE) %>%
filter(!is.na(OBS_VALUE)) %>%
group_by(COUNTERPART_AREA, Counterpart_area) %>%
summarise(Nobs = n(),
first = first(TIME_PERIOD),
last = last(TIME_PERIOD)) %>%
mutate(Flag = gsub(" ", "-", str_to_lower(gsub(" ", "-", Counterpart_area))),
Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) %>%
select(Flag, everything()) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .} {
%>%
DOT_DE left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
filter(TIME_PERIOD %in% c("2019", "2013", "2011", "2007", "2004", "2000", "1997"),
== "TBG_USD") %>%
INDICATOR mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
select(COUNTERPART_AREA, Counterpart_area, TIME_PERIOD, OBS_VALUE) %>%
spread(TIME_PERIOD, OBS_VALUE) %>%
arrange(-`2019`) %>%
mutate_at(vars(-1, -2), funs(round(100*., 2))) %>%
mutate(Flag = gsub(" ", "-", str_to_lower(gsub(" ", "-", Counterpart_area))),
Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) %>%
select(Flag, everything()) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .} {
%>%
DOT_DE left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
filter(TIME_PERIOD %in% c("2019", "2013", "2011", "2007", "2004", "2000", "1997"),
== "TBG_USD") %>%
INDICATOR mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
select(COUNTERPART_AREA, Counterpart_area, TIME_PERIOD, OBS_VALUE) %>%
spread(TIME_PERIOD, OBS_VALUE) %>%
arrange(-`2019`) %>%
mutate_at(vars(-1, -2), funs(round(100*., 2))) %>%
mutate(Flag = gsub(" ", "-", str_to_lower(gsub(" ", "-", Counterpart_area))),
Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) %>%
select(Flag, everything()) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .} {
%>%
DOT_DE left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
filter(TIME_PERIOD %in% c("1997", "2019", "2011"),
== "TBG_USD") %>%
INDICATOR mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
select(COUNTERPART_AREA, Counterpart_area, TIME_PERIOD, OBS_VALUE) %>%
spread(TIME_PERIOD, OBS_VALUE) %>%
arrange(-`2019`) %>%
transmute(COUNTERPART_AREA, Counterpart_area,
`1997-2011` = `2011` - `1997`) %>%
arrange(`1997-2011`) %>%
mutate_at(vars(-1, -2), funs(round(100*., 2))) %>%
mutate(Flag = gsub(" ", "-", str_to_lower(gsub(" ", "-", Counterpart_area))),
Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) %>%
select(Flag, everything()) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .} {
%>%
DOT_DE left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
filter(TIME_PERIOD %in% c("2019", "2013", "2010", "2007", "2004"),
== "TMG_CIF_USD") %>%
INDICATOR mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
select(COUNTERPART_AREA, Counterpart_area, TIME_PERIOD, OBS_VALUE) %>%
spread(TIME_PERIOD, OBS_VALUE) %>%
arrange(-`2019`) %>%
mutate_at(vars(-1, -2), funs(paste0(round(100*., 2), " %"))) %>%
mutate(Flag = gsub(" ", "-", str_to_lower(gsub(" ", "-", Counterpart_area))),
Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) %>%
select(Flag, everything()) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .} {
%>%
DOT_DE left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
filter(TIME_PERIOD %in% c("2019", "2013", "2010", "2007", "2004"),
== "TXG_FOB_USD") %>%
INDICATOR mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
select(COUNTERPART_AREA, Counterpart_area, TIME_PERIOD, OBS_VALUE) %>%
spread(TIME_PERIOD, OBS_VALUE) %>%
arrange(-`2019`) %>%
mutate_at(vars(-1, -2), funs(paste0(round(100*., 2), " %"))) %>%
mutate(Flag = gsub(" ", "-", str_to_lower(gsub(" ", "-", Counterpart_area))),
Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) %>%
select(Flag, everything()) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .} {
%>%
DOT_DE filter(COUNTERPART_AREA %in% c("CN", "US", "E1", "FR"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 filter(date >= as.Date("1991-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
left_join(colors, by = c("Counterpart_area" = "country")) %>%
mutate(color = ifelse(COUNTERPART_AREA == "FR", color2, color)) %>%
ggplot(.) + theme_minimal() + scale_color_identity() +
geom_line(aes(x = date, y = OBS_VALUE, color = color)) +
theme(legend.position = "none") +
+
add_4flags scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .2),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("Germany Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_DE filter(COUNTERPART_AREA %in% c("CN", "US", "E1", "FR", "GB", "CH"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 filter(date >= as.Date("1991-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
left_join(colors, by = c("Counterpart_area" = "country")) %>%
mutate(color = ifelse(COUNTERPART_AREA == "FR", color2, color)) %>%
ggplot(.) + theme_minimal() + scale_color_identity() +
geom_line(aes(x = date, y = OBS_VALUE, color = color)) +
theme(legend.position = "none") +
+
add_6flags scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .2),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("Germany Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_DE filter(COUNTERPART_AREA %in% c("GB", "SE", "CH"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 filter(date >= as.Date("1991-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
ggplot(.) + theme_minimal() +
scale_color_manual(values = c("#FECC00", "#FF0000", "#6E82B5")) +
geom_line(aes(x = date, y = OBS_VALUE, color = Counterpart_area)) +
theme(legend.position = "none") +
+
add_3flags scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .2),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("Germany Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_DE filter(COUNTERPART_AREA %in% c("TR", "AE", "AU"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 filter(date >= as.Date("1991-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
ggplot(.) + theme_minimal() +
scale_color_manual(values = c("#00008B", "#E30A17", "#00732F")) +
geom_line(aes(x = date, y = OBS_VALUE, color = Counterpart_area)) +
theme(legend.position = "none") +
scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .1),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("Germany Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_DE filter(COUNTERPART_AREA %in% c("ES", "IT", "FR", "GB"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 filter(date >= as.Date("1991-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
ggplot(.) + theme_minimal() +
scale_color_manual(values = c("#0D5EAF", "#009246", "#FFC400", "#CF142B")) +
geom_line(aes(x = date, y = OBS_VALUE, color = Counterpart_area)) +
theme(legend.position = "none") +
+
add_4flags scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .2),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("Germany Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_DE filter(COUNTERPART_AREA %in% c("US", "FR", "GB"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 filter(date >= as.Date("1991-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
ggplot(.) + theme_minimal() +
scale_color_manual(values = c("#0D5EAF", "#CF142B", "#FFC400")) +
geom_line(aes(x = date, y = OBS_VALUE, color = Counterpart_area)) +
theme(legend.position = "none") +
+
add_3flags scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .2),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("Germany Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_DE filter(COUNTERPART_AREA %in% c("US", "FR", "GB"),
%in% c("TBG_USD"),
INDICATOR == "Q") %>%
FREQ left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
quarter_to_date2 filter(date >= as.Date("1991-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
ggplot(.) + theme_minimal() +
scale_color_manual(values = c("#0D5EAF", "#CF142B", "#FFC400")) +
geom_line(aes(x = date, y = OBS_VALUE, color = Counterpart_area)) +
theme(legend.position = "none") +
+
add_3flags scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .2),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("Germany Bilateral Trade Surplus (% of GDP)")
%>%
DOT_DE filter(COUNTERPART_AREA %in% c("ES", "IT", "PT", "GR"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 filter(date >= as.Date("1991-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
ggplot(.) + theme_minimal() +
scale_color_manual(values = c("#0D5EAF", "#009246", "#FF0000", "#FFC400")) +
geom_line(aes(x = date, y = OBS_VALUE, color = Counterpart_area)) +
theme(legend.position = "none") +
+
add_4flags scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .2),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("Germany Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_FR left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
filter(TIME_PERIOD %in% c("2019", "2013", "2011", "2007", "2004", "2000", "1997"),
== "TBG_USD") %>%
INDICATOR mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
select(COUNTERPART_AREA, Counterpart_area, TIME_PERIOD, OBS_VALUE) %>%
spread(TIME_PERIOD, OBS_VALUE) %>%
arrange(-`2019`) %>%
mutate_at(vars(-1, -2), funs(round(100*., 2))) %>%
mutate(Flag = gsub(" ", "-", str_to_lower(gsub(" ", "-", Counterpart_area))),
Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) %>%
select(Flag, everything()) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .} {
%>%
DOT_FR filter(COUNTERPART_AREA %in% c("CN", "DE", "U2"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
filter(REF_AREA == "FR",
== "A") %>%
FREQ mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = "TIME_PERIOD") %>%
%>%
year_to_date2 filter(date >= as.Date("1980-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
mutate(Counterpart_area = ifelse(COUNTERPART_AREA == "U2", "Europe", Counterpart_area),
Counterpart_area = ifelse(COUNTERPART_AREA == "W00", "World", Counterpart_area)) %>%
left_join(colors, by = c("Counterpart_area" = "country")) %>%
mutate(color = ifelse(COUNTERPART_AREA == "DE", color2, color)) %>%
ggplot(.) + theme_minimal() + scale_color_identity() +
geom_line(aes(x = date, y = OBS_VALUE, color = color)) +
theme(legend.position = "none") + add_3flags +
scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, 1),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("France Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_FR filter(COUNTERPART_AREA %in% c("CN", "DE", "U2"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
filter(REF_AREA == "FR",
== "A") %>%
FREQ mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = "TIME_PERIOD") %>%
%>%
year_to_date2 filter(date >= as.Date("1990-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
mutate(Counterpart_area = ifelse(COUNTERPART_AREA == "U2", "Europe", Counterpart_area),
Counterpart_area = ifelse(COUNTERPART_AREA == "W00", "World", Counterpart_area)) %>%
left_join(colors, by = c("Counterpart_area" = "country")) %>%
mutate(color = ifelse(COUNTERPART_AREA == "DE", color2, color)) %>%
ggplot(.) + theme_minimal() + scale_color_identity() +
geom_line(aes(x = date, y = OBS_VALUE, color = color)) +
theme(legend.position = "none") + add_3flags +
scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, 1),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("France Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_FR filter(COUNTERPART_AREA %in% c("CN", "DE", "U2", "W00"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
filter(REF_AREA == "FR",
== "A") %>%
FREQ mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = "TIME_PERIOD") %>%
%>%
year_to_date2 filter(date >= as.Date("1960-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
mutate(Counterpart_area = ifelse(COUNTERPART_AREA == "U2", "Europe", Counterpart_area),
Counterpart_area = ifelse(COUNTERPART_AREA == "W00", "World", Counterpart_area)) %>%
left_join(colors, by = c("Counterpart_area" = "country")) %>%
mutate(color = ifelse(COUNTERPART_AREA == "DE", color2, color)) %>%
ggplot(.) + theme_minimal() + scale_color_identity() +
geom_line(aes(x = date, y = OBS_VALUE, color = color)) +
theme(legend.position = "none") + add_4flags +
scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, 1),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("France Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_FR filter(COUNTERPART_AREA %in% c("CN", "DE", "U2", "W00"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
filter(REF_AREA == "FR",
== "A") %>%
FREQ mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = "TIME_PERIOD") %>%
%>%
year_to_date2 filter(date >= as.Date("1980-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
mutate(Counterpart_area = ifelse(COUNTERPART_AREA == "U2", "Europe", Counterpart_area),
Counterpart_area = ifelse(COUNTERPART_AREA == "W00", "World", Counterpart_area)) %>%
left_join(colors, by = c("Counterpart_area" = "country")) %>%
mutate(color = ifelse(COUNTERPART_AREA == "DE", color2, color)) %>%
ggplot(.) + theme_minimal() + scale_color_identity() +
geom_line(aes(x = date, y = OBS_VALUE, color = color)) +
theme(legend.position = "none") + add_4flags +
scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, 1),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("France Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_FR filter(COUNTERPART_AREA %in% c("CN", "DE", "U2", "W00"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
filter(REF_AREA == "FR",
== "A") %>%
FREQ mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = "TIME_PERIOD") %>%
%>%
year_to_date2 filter(date >= as.Date("1990-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
mutate(Counterpart_area = ifelse(COUNTERPART_AREA == "U2", "Europe", Counterpart_area),
Counterpart_area = ifelse(COUNTERPART_AREA == "W00", "World", Counterpart_area)) %>%
left_join(colors, by = c("Counterpart_area" = "country")) %>%
mutate(color = ifelse(COUNTERPART_AREA == "DE", color2, color)) %>%
ggplot(.) + theme_minimal() + scale_color_identity() +
geom_line(aes(x = date, y = OBS_VALUE, color = color)) +
theme(legend.position = "none") + add_4flags +
scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, 1),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("France Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_FR filter(COUNTERPART_AREA %in% c("NL", "DE", "ES", "IT"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
filter(REF_AREA == "FR",
== "A") %>%
FREQ mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = "TIME_PERIOD") %>%
%>%
year_to_date2 filter(date >= as.Date("1950-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
left_join(colors, by = c("Counterpart_area" = "country")) %>%
ggplot(.) + theme_minimal() + scale_color_identity() +
geom_line(aes(x = date, y = OBS_VALUE, color = color)) +
theme(legend.position = "none") + add_4flags +
scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .1),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("France Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_FR filter(TIME_PERIOD %in% c("2019", "2013", "2010", "2007", "2004"),
== "TBG_USD") %>%
INDICATOR mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
select(COUNTERPART_AREA, Counterpart_area, TIME_PERIOD, OBS_VALUE) %>%
spread(TIME_PERIOD, OBS_VALUE) %>%
arrange(-`2019`) %>%
mutate_at(vars(-1, -2), funs(paste0("$ ", round(./10^9, 1), " Bn"))) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F) else .} {
%>%
DOT_FR left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
filter(INDICATOR == "TBG_USD") %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
select(COUNTERPART_AREA, Counterpart_area, TIME_PERIOD, OBS_VALUE) %>%
filter(!is.na(OBS_VALUE)) %>%
group_by(COUNTERPART_AREA, Counterpart_area) %>%
summarise(Nobs = n(),
first = first(TIME_PERIOD),
last = last(TIME_PERIOD)) %>%
mutate(Flag = gsub(" ", "-", str_to_lower(gsub(" ", "-", Counterpart_area))),
Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) %>%
select(Flag, everything()) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .} {
%>%
DOT_FR left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
filter(TIME_PERIOD %in% c("2019", "2013", "2011", "2007", "2004", "2000", "1997"),
== "TBG_USD") %>%
INDICATOR mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
select(COUNTERPART_AREA, Counterpart_area, TIME_PERIOD, OBS_VALUE) %>%
spread(TIME_PERIOD, OBS_VALUE) %>%
arrange(-`2019`) %>%
mutate_at(vars(-1, -2), funs(round(100*., 2))) %>%
mutate(Flag = gsub(" ", "-", str_to_lower(gsub(" ", "-", Counterpart_area))),
Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) %>%
select(Flag, everything()) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .} {
%>%
DOT_FR left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
filter(TIME_PERIOD %in% c("1997", "2019", "2011"),
== "TBG_USD") %>%
INDICATOR mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
select(COUNTERPART_AREA, Counterpart_area, TIME_PERIOD, OBS_VALUE) %>%
spread(TIME_PERIOD, OBS_VALUE) %>%
arrange(-`2019`) %>%
transmute(COUNTERPART_AREA, Counterpart_area,
`1997-2011` = `2011` - `1997`) %>%
arrange(`1997-2011`) %>%
mutate_at(vars(-1, -2), funs(round(100*., 2))) %>%
mutate(Flag = gsub(" ", "-", str_to_lower(gsub(" ", "-", Counterpart_area))),
Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) %>%
select(Flag, everything()) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .} {
%>%
DOT_FR left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
filter(TIME_PERIOD %in% c("2019", "2013", "2010", "2007", "2004"),
== "TMG_CIF_USD") %>%
INDICATOR mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
select(COUNTERPART_AREA, Counterpart_area, TIME_PERIOD, OBS_VALUE) %>%
spread(TIME_PERIOD, OBS_VALUE) %>%
arrange(-`2019`) %>%
mutate_at(vars(-1, -2), funs(paste0(round(100*., 2), " %"))) %>%
mutate(Flag = gsub(" ", "-", str_to_lower(gsub(" ", "-", Counterpart_area))),
Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) %>%
select(Flag, everything()) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .} {
%>%
DOT_FR left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
filter(TIME_PERIOD %in% c("2019", "2013", "2010", "2007", "2004"),
== "TXG_FOB_USD") %>%
INDICATOR mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
select(COUNTERPART_AREA, Counterpart_area, TIME_PERIOD, OBS_VALUE) %>%
spread(TIME_PERIOD, OBS_VALUE) %>%
arrange(-`2019`) %>%
mutate_at(vars(-1, -2), funs(paste0(round(100*., 2), " %"))) %>%
mutate(Flag = gsub(" ", "-", str_to_lower(gsub(" ", "-", Counterpart_area))),
Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) %>%
select(Flag, everything()) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .} {
%>%
DOT_FR filter(COUNTERPART_AREA %in% c("JP", "F6", "KR"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
filter(REF_AREA == "FR",
== "A") %>%
FREQ mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = "TIME_PERIOD") %>%
%>%
year_to_date2 filter(date >= as.Date("1950-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
mutate(Counterpart_area = case_when(COUNTERPART_AREA == "KR" ~ "Korea",
~ Counterpart_area)) %>%
T left_join(colors, by = c("Counterpart_area" = "country")) %>%
ggplot(.) + theme_minimal() + scale_color_identity() +
geom_line(aes(x = date, y = OBS_VALUE, color = color)) +
theme(legend.position = "none") +
scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .2),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("France Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_FR filter(COUNTERPART_AREA %in% c("JP", "F6", "KR"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
filter(REF_AREA == "FR",
== "A") %>%
FREQ mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = "TIME_PERIOD") %>%
%>%
year_to_date2 filter(date >= as.Date("1950-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
mutate(Counterpart_area = case_when(COUNTERPART_AREA == "KR" ~ "Korea",
~ Counterpart_area)) %>%
T left_join(colors, by = c("Counterpart_area" = "country")) %>%
ggplot(.) + theme_minimal() + scale_color_identity() +
geom_line(aes(x = date, y = OBS_VALUE, color = color)) +
theme(legend.position = "none") +
scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .2),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("France Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_FR filter(COUNTERPART_AREA %in% c("JP", "F6", "KR"),
%in% c("TXG_FOB_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
filter(REF_AREA == "FR",
== "A") %>%
FREQ mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = "TIME_PERIOD") %>%
%>%
year_to_date2 filter(date >= as.Date("1950-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
mutate(Counterpart_area = case_when(COUNTERPART_AREA == "KR" ~ "Korea",
~ Counterpart_area)) %>%
T left_join(colors, by = c("Counterpart_area" = "country")) %>%
ggplot(.) + theme_minimal() + scale_color_identity() +
geom_line(aes(x = date, y = OBS_VALUE, color = color)) +
theme(legend.position = "none") +
scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .2),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("France Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_FR filter(COUNTERPART_AREA %in% c("JP", "F6", "KR"),
%in% c("TMG_CIF_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
filter(REF_AREA == "FR",
== "A") %>%
FREQ mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = "TIME_PERIOD") %>%
%>%
year_to_date2 filter(date >= as.Date("1950-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
mutate(Counterpart_area = case_when(COUNTERPART_AREA == "KR" ~ "Korea",
~ Counterpart_area)) %>%
T left_join(colors, by = c("Counterpart_area" = "country")) %>%
ggplot(.) + theme_minimal() + scale_color_identity() +
geom_line(aes(x = date, y = OBS_VALUE, color = color)) +
theme(legend.position = "none") +
scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .2),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("France Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_FR filter(COUNTERPART_AREA %in% c("CN", "US", "E1", "DE"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
filter(REF_AREA == "FR",
== "A") %>%
FREQ mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = "TIME_PERIOD") %>%
%>%
year_to_date2 filter(date >= as.Date("1950-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
left_join(colors, by = c("Counterpart_area" = "country")) %>%
ggplot(.) + theme_minimal() + scale_color_identity() +
geom_line(aes(x = date, y = OBS_VALUE, color = color)) +
theme(legend.position = "none") + add_4flags +
scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .1),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("France Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_FR filter(COUNTERPART_AREA %in% c("CN", "US", "E1", "DE"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
filter(REF_AREA == "FR",
== "A") %>%
FREQ mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = "TIME_PERIOD") %>%
%>%
year_to_date2 filter(date >= as.Date("1980-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
left_join(colors, by = c("Counterpart_area" = "country")) %>%
ggplot(.) + theme_minimal() + scale_color_identity() +
geom_line(aes(x = date, y = OBS_VALUE, color = color)) +
theme(legend.position = "none") + add_4flags +
scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .1),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("France Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_FR filter(COUNTERPART_AREA %in% c("GB", "SE", "CH"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 filter(date >= as.Date("1991-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
left_join(colors, by = c("Counterpart_area" = "country")) %>%
ggplot(.) + theme_minimal() + scale_color_identity() +
geom_line(aes(x = date, y = OBS_VALUE, color = color)) +
theme(legend.position = "none") + add_3flags +
scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .1),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("France Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_FR filter(COUNTERPART_AREA %in% c("TR", "AE", "AU"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 filter(date >= as.Date("1991-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
left_join(colors, by = c("Counterpart_area" = "country")) %>%
ggplot(.) + theme_minimal() + scale_color_identity() +
geom_line(aes(x = date, y = OBS_VALUE, color = color)) +
theme(legend.position = "none") +
scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .1),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("France Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_FR filter(COUNTERPART_AREA %in% c("ES", "IT", "DE", "GB"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 filter(date >= as.Date("1991-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
left_join(colors, by = c("Counterpart_area" = "country")) %>%
ggplot(.) + theme_minimal() + scale_color_identity() +
geom_line(aes(x = date, y = OBS_VALUE, color = color)) +
theme(legend.position = "none") + add_4flags +
scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .2),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("France Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_FR filter(COUNTERPART_AREA %in% c("ES", "IT", "DE", "GB"),
%in% c("TMG_CIF_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 filter(date >= as.Date("1991-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
left_join(colors, by = c("Counterpart_area" = "country")) %>%
ggplot(.) + theme_minimal() + scale_color_identity() +
geom_line(aes(x = date, y = OBS_VALUE, color = color)) +
theme(legend.position = "none") + add_4flags +
scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .2),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("France Bilateral Imports (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_FR filter(COUNTERPART_AREA %in% c("ES", "IT", "DE", "GB"),
%in% c("TXG_FOB_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 filter(date >= as.Date("1991-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
left_join(colors, by = c("Counterpart_area" = "country")) %>%
ggplot(.) + theme_minimal() + scale_color_identity() +
geom_line(aes(x = date, y = OBS_VALUE, color = color)) +
theme(legend.position = "none") + add_4flags +
scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .2),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("France Bilateral Exports (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_FR filter(COUNTERPART_AREA %in% c("ES", "IT", "DE", "GB"),
%in% c("TMG_CIF_USD", "TXG_FOB_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 filter(date >= as.Date("1991-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
ggplot(.) + theme_minimal() +
scale_color_manual(values = c("#000000", "#009246", "#FFC400", "#CF142B")) +
geom_line(aes(x = date, y = OBS_VALUE, color = Counterpart_area, linetype = INDICATOR)) +
theme(legend.position = "none") +
geom_image(data = . %>%
filter(date == as.Date("2014-01-01")) %>%
mutate(image = paste0("../../icon/flag/", str_to_lower(gsub(" ", "-", Counterpart_area)), ".png")),
aes(x = date, y = OBS_VALUE, image = image), asp = 1.5) +
scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .2),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("Imports (% of GDP)")
%>%
DOT_FR filter(COUNTERPART_AREA %in% c("ES", "IT", "PT", "GR"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 filter(date >= as.Date("1991-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
left_join(colors, by = c("Counterpart_area" = "country")) %>%
ggplot(.) + theme_minimal() + scale_color_identity() +
geom_line(aes(x = date, y = OBS_VALUE, color = color)) +
theme(legend.position = "none") + add_4flags +
scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .2),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("France Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_FR filter(COUNTERPART_AREA %in% c("ES", "IT", "PT", "GR"),
%in% c("TMG_CIF_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 filter(date >= as.Date("1991-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
ggplot(.) + theme_minimal() +
scale_color_manual(values = c("#0D5EAF", "#009246", "#FF0000", "#FFC400")) +
geom_line(aes(x = date, y = OBS_VALUE, color = Counterpart_area)) +
theme(legend.position = "none") +
+
add_4flags scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .2),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("Imports (% of GDP)")
%>%
DOT_FR filter(COUNTERPART_AREA %in% c("ES", "IT", "PT", "GR"),
%in% c("TXG_FOB_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 filter(date >= as.Date("1991-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
ggplot(.) + theme_minimal() +
scale_color_manual(values = c("#0D5EAF", "#009246", "#FF0000", "#FFC400")) +
geom_line(aes(x = date, y = OBS_VALUE, color = Counterpart_area)) +
theme(legend.position = "none") +
+
add_4flags scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .2),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("Exports (% of GDP)")
%>%
DOT_FR filter(COUNTERPART_AREA %in% c("DE"),
%in% c("TMG_CIF_USD", "TXG_FOB_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 #filter(date >= as.Date("1970-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
left_join(tibble(INDICATOR = c("TMG_CIF_USD", "TXG_FOB_USD"),
Indicator = c("Imports", "Exports")), by = "INDICATOR") %>%
ggplot(.) + theme_minimal() +
scale_color_manual(values = c("#000000", "#009246", "#FFC400", "#CF142B")) +
geom_line(aes(x = date, y = OBS_VALUE, linetype = Indicator)) +
theme(legend.position = c(0.3, 0.9)) +
geom_image(data = . %>%
filter(date == as.Date("2014-01-01")) %>%
mutate(image = paste0("../../icon/flag/", str_to_lower(gsub(" ", "-", Counterpart_area)), ".png")),
aes(x = date, y = OBS_VALUE, image = image), asp = 1.5) +
scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .5),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("% of GDP")
%>%
DOT_U2 filter(TIME_PERIOD %in% c("2019", "2013", "2010", "2007", "2004"),
== "TBG_USD") %>%
INDICATOR mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
select(COUNTERPART_AREA, Counterpart_area, TIME_PERIOD, OBS_VALUE) %>%
spread(TIME_PERIOD, OBS_VALUE) %>%
arrange(-`2019`) %>%
mutate_at(vars(-1, -2), funs(paste0("$ ", round(./10^9, 1), " Bn"))) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F) else .} {
%>%
DOT_U2 left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
filter(TIME_PERIOD %in% c("2019", "2013", "2010", "2007", "2004"),
== "TBG_USD") %>%
INDICATOR mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
select(COUNTERPART_AREA, Counterpart_area, TIME_PERIOD, OBS_VALUE) %>%
spread(TIME_PERIOD, OBS_VALUE) %>%
arrange(-`2019`) %>%
mutate_at(vars(-1, -2), funs(round(100*., 2))) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F) else .} {
%>%
DOT_U2 filter(COUNTERPART_AREA %in% c("ES", "IT", "FR", "DE", "NL"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ %>%
year_to_date2 filter(date >= as.Date("1995-01-01")) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
mutate(OBS_VALUE = OBS_VALUE/1000) %>%
ggplot(.) + theme_minimal() +
scale_color_manual(values = c("#002395", "#000000", "#009246", "#AE1C28", "#FFC400")) +
geom_line(aes(x = date, y = OBS_VALUE, color = Counterpart_area)) +
theme(legend.position = "none") + add_5flags +
scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = seq(-500, 500, 50)) +
xlab("") + ylab("Europe Bilateral Trade Surplus (% of GDP)")
%>%
DOT_U2 filter(COUNTERPART_AREA %in% c("ES", "IT", "FR", "DE", "NL"),
%in% c("TBG_USD"),
INDICATOR == "Q") %>%
FREQ %>%
quarter_to_date2 filter(date >= as.Date("1995-01-01")) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
mutate(OBS_VALUE = OBS_VALUE/1000) %>%
ggplot(.) + theme_minimal() +
scale_color_manual(values = c("#002395", "#000000", "#009246", "#AE1C28", "#FFC400")) +
geom_line(aes(x = date, y = OBS_VALUE, color = Counterpart_area)) +
theme(legend.position = "none") + add_5flags +
scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = seq(-500, 500, 10)) +
xlab("") + ylab("Europe Bilateral Trade Surplus (% of GDP)")
%>%
DOT_U2 filter(COUNTERPART_AREA %in% c("ES", "IT", "FR", "DE", "NL"),
%in% c("TBG_USD"),
INDICATOR == "M") %>%
FREQ %>%
month_to_date2 filter(date >= as.Date("1995-01-01")) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
mutate(OBS_VALUE = OBS_VALUE/1000) %>%
ggplot(.) + theme_minimal() +
scale_color_manual(values = c("#002395", "#000000", "#009246", "#AE1C28", "#FFC400")) +
geom_line(aes(x = date, y = OBS_VALUE, color = Counterpart_area)) +
theme(legend.position = "none") + add_5flags +
scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = seq(-500, 500, 5)) +
xlab("") + ylab("Europe Bilateral Trade Surplus (% of GDP)")
%>%
DOT_U2 filter(COUNTERPART_AREA %in% c("ES", "IT", "FR", "DE", "NL"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 filter(date >= as.Date("1995-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
ggplot(.) + theme_minimal() +
scale_color_manual(values = c("#002395", "#000000", "#009246", "#AE1C28", "#FFC400")) +
geom_line(aes(x = date, y = OBS_VALUE, color = Counterpart_area)) +
theme(legend.position = "none") +
geom_image(data = . %>%
filter(date == as.Date("2005-01-01")) %>%
mutate(image = paste0("../../icon/flag/", str_to_lower(gsub(" ", "-", Counterpart_area)), ".png")),
aes(x = date, y = OBS_VALUE, image = image), asp = 1.5) +
scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .2),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("Europe Bilateral Trade Surplus (% of GDP)")
%>%
DOT_U2 filter(COUNTERPART_AREA %in% c("CN", "FR", "E1", "DE"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 filter(date >= as.Date("1995-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
ggplot(.) + theme_minimal() +
scale_color_manual(values = c("#FFDC00", "#003399", "#000000", "#B22234")) +
geom_line(aes(x = date, y = OBS_VALUE, color = Counterpart_area)) +
theme(legend.position = "none") +
+
add_4flags scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .2),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("Europe Bilateral Trade Surplus (% of GDP)")
%>%
DOT_US filter(TIME_PERIOD %in% c("2019", "2013", "2010", "2007", "2004"),
== "TBG_USD") %>%
INDICATOR mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
select(COUNTERPART_AREA, Counterpart_area, TIME_PERIOD, OBS_VALUE) %>%
spread(TIME_PERIOD, OBS_VALUE) %>%
arrange(-`2019`) %>%
mutate_at(vars(-1, -2), funs(paste0("$ ", round(./10^9, 1), " Bn"))) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F) else .} {
%>%
DOT_US left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
filter(TIME_PERIOD %in% c("2019", "2013", "2010", "2007", "2004"),
== "TBG_USD") %>%
INDICATOR mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
select(COUNTERPART_AREA, Counterpart_area, TIME_PERIOD, OBS_VALUE) %>%
spread(TIME_PERIOD, OBS_VALUE) %>%
arrange(-`2019`) %>%
mutate_at(vars(-1, -2), funs(round(100*., 2))) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F) else .} {
%>%
DOT_US filter(COUNTERPART_AREA %in% c("CN", "FR", "E1", "DE"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 filter(date >= as.Date("1950-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
left_join(colors, by = c("Counterpart_area" = "country")) %>%
mutate(color = ifelse(COUNTERPART_AREA == "FR", color2, color)) %>%
ggplot(.) + theme_minimal() +
scale_color_identity() +
geom_line(aes(x = date, y = OBS_VALUE, color = color)) +
theme(legend.position = "none") +
+
add_4flags scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .2),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("United States Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_US filter(COUNTERPART_AREA %in% c("CN", "FR", "E1", "DE"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 filter(date >= as.Date("1960-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
left_join(colors, by = c("Counterpart_area" = "country")) %>%
mutate(color = ifelse(COUNTERPART_AREA == "FR", color2, color)) %>%
ggplot(.) + theme_minimal() +
scale_color_identity() +
geom_line(aes(x = date, y = OBS_VALUE, color = color)) +
theme(legend.position = "none") +
+
add_4flags scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .2),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("United States Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_US filter(COUNTERPART_AREA %in% c("CN", "FR", "E1", "DE"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)) %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 filter(date >= as.Date("1980-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
left_join(colors, by = c("Counterpart_area" = "country")) %>%
mutate(color = ifelse(COUNTERPART_AREA == "FR", color2, color)) %>%
ggplot(.) + theme_minimal() +
scale_color_identity() +
geom_line(aes(x = date, y = OBS_VALUE, color = color)) +
theme(legend.position = "none") +
+
add_4flags scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .2),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("United States Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_US filter(COUNTERPART_AREA %in% c("CN", "E1", "DE", "W00"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 filter(date >= as.Date("1980-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
mutate(Counterpart_area = ifelse(COUNTERPART_AREA == "U2", "Europe", Counterpart_area),
Counterpart_area = ifelse(COUNTERPART_AREA == "W00", "World", Counterpart_area)) %>%
left_join(colors, by = c("Counterpart_area" = "country")) %>%
mutate(color = ifelse(COUNTERPART_AREA == "DE", color2, color)) %>%
ggplot(.) + theme_minimal() +
scale_color_identity() +
geom_line(aes(x = date, y = OBS_VALUE, color = color)) +
theme(legend.position = "none") +
+
add_4flags scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .2),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("United States Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")
%>%
DOT_US filter(COUNTERPART_AREA %in% c("CN", "E1", "DE"),
%in% c("TBG_USD"),
INDICATOR == "A") %>%
FREQ left_join(NGDP_USD %>%
select(FREQ, REF_AREA, TIME_PERIOD, NGDP_USD = OBS_VALUE),
by = c("TIME_PERIOD", "REF_AREA", "FREQ")) %>%
%>%
year_to_date2 filter(date >= as.Date("1980-01-01")) %>%
mutate(OBS_VALUE = OBS_VALUE*10^(UNIT_MULT)/NGDP_USD) %>%
left_join(COUNTERPART_AREA, by = "COUNTERPART_AREA") %>%
mutate(Counterpart_area = ifelse(COUNTERPART_AREA == "U2", "Europe", Counterpart_area),
Counterpart_area = ifelse(COUNTERPART_AREA == "W00", "World", Counterpart_area)) %>%
left_join(colors, by = c("Counterpart_area" = "country")) %>%
mutate(color = ifelse(COUNTERPART_AREA == "DE", color2, color)) %>%
ggplot(.) + theme_minimal() +
scale_color_identity() +
geom_line(aes(x = date, y = OBS_VALUE, color = color)) +
theme(legend.position = "none") +
+
add_3flags scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%Y")) +
scale_y_continuous(breaks = 0.01*seq(-500, 500, .2),
labels = percent_format(accuracy = .1)) +
xlab("") + ylab("United States Bilateral Trade Surplus (% of GDP)") +
geom_hline(yintercept = 0, linetype = "dashed", color = "black")