Series Id: EIUIR Series Title: Monthly import price index for BEA End Use, All commodities, not seasonally adjusted Index Type: BEA End Use Import Indexes Item: All commodities Base Period: 2000=100
Series Id: EIUIQ Series Title: Monthly export price index for BEA End Use, All commodities, not seasonally adjusted Index Type: BEA End Use Export Indexes Item: All commodities Base Period: 2000=100
trade <-pdfetch_BLS(c("EIUIR","EIUIQ"), 2019, 2020)
myDF <- as.data.frame(as.matrix(trade))
myDF$date <- as.Date(row.names(myDF))
colnames(myDF) <- c("Import","Export","date")
data_long <- melt(myDF, id.vars=c("date"))
colnames(data_long) <- c("date","Direction","Index")
# plotting data
data_long %>% ggplot() +
geom_line(mapping = aes(x=date,y=Index,color=Direction),size=1) +
labs(title = "Monthly export/import price index for BEA End Use, All commodities",
subtitle = str_glue("Base Period: Year 2000= 100 Index\n From {min(data_long$date)} through {max(data_long$date)}"),
x="Monthly", y="Rate",
caption = "Data source: FRED Federal Reserve. Illustration by @JoeLongSanDiego")+
theme_economist()

Exports of Goods and Services, Balance of Payments Basis (BOPTEXP)
Imports of Goods and Services: Balance of Payments Basis (BOPTIMP)
import <-fredr_series_observations(series_id = "BOPTIMP",
observation_start = as.Date("2019-01-01"))
export <-fredr_series_observations(series_id = "BOPTEXP",
observation_start = as.Date("2019-01-01"))
indicator <-as.data.frame(import$date)
colnames(indicator) <- "date"
indicator$import <- import$value
indicator$export <- export$value
indicator %>% kable() %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed")) %>%
column_spec(2, T, color = "red" ) %>%
column_spec(3, T, color = "blue")
date
|
import
|
export
|
2019-01-01
|
259267
|
210243
|
2019-02-01
|
258109
|
210809
|
2019-03-01
|
262072
|
213157
|
2019-04-01
|
258491
|
209288
|
2019-05-01
|
264110
|
212852
|
2019-06-01
|
261003
|
209254
|
2019-07-01
|
261503
|
210462
|
2019-08-01
|
261295
|
210517
|
2019-09-01
|
257049
|
209210
|
2019-10-01
|
253432
|
210403
|
2019-11-01
|
251625
|
210571
|
2019-12-01
|
257171
|
211496
|
2020-01-01
|
252488
|
210446
|
2020-02-01
|
246425
|
211752
|
2020-03-01
|
232524
|
190184
|
2020-04-01
|
200890
|
151133
|
2020-05-01
|
199488
|
144687
|
2020-06-01
|
208949
|
158253
|
data_long <- melt(indicator, id.vars=c("date"))
colnames(data_long) <- c("date","Trade","Value")
# plotting data
data_long %>% ggplot() +
geom_line(mapping = aes(x=date,y=Value,color=Trade),size=1) +
labs(title = "Balance of Payments Basis: Import/Export \nDuring COVID19 Pandemic",
subtitle = str_glue("From {min(indicator$date)} through {max(indicator$date)}"),
x="Monthly", y="Millions of Dollars",
caption = "Data source: FRED Federal Reserve. Illustration by @JoeLongSanDiego")+
theme_economist()

highchart() %>%
hc_chart(type = "column") %>%
hc_xAxis(categories = indicator$date) %>%
hc_add_series(name="Import",data = indicator$import) %>%
hc_add_series(name="Export",data = indicator$export) %>%
hc_subtitle(text=str_glue("From {min(indicator$date)} through {max(indicator$date)}"), align = "center") %>%
hc_title(text = "Balance of Payments Basis: Import/Export _ during COVID19 Pandemic",
style = list(fontWeight = "bold", fontSize = "20px"),
align = "center") %>%
hc_credits(enabled = TRUE,text = "Data Source: FRED Federal Reserve _ Illustration by @JoeLongSanDiego") %>%
hc_yAxis(title = list(text = "Millions of Dollars")) %>%
hc_add_theme(hc_theme_economist())
Imports of Goods and Services (IMPGS)
Exports of Goods and Services (EXPGS)
import <-fredr_series_observations(series_id = "IMPGS",
observation_start = as.Date("2019-01-01"))
export <-fredr_series_observations(series_id = "EXPGS",
observation_start = as.Date("2019-01-01"))
indicator <-as.data.frame(import$date)
colnames(indicator) <- "date"
indicator$import <- import$value
indicator$export <- export$value
indicator %>% kable() %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed")) %>%
column_spec(2, T, color = "red" ) %>%
column_spec(3, T, color = "blue")
date
|
import
|
export
|
2019-01-01
|
3139
|
2523
|
2019-04-01
|
3159
|
2515
|
2019-07-01
|
3137
|
2505
|
2019-10-01
|
3065
|
2516
|
2020-01-01
|
2933
|
2439
|
2020-04-01
|
2343
|
1798
|
data_long <- melt(indicator, id.vars=c("date"))
colnames(data_long) <- c("date","Trade","Value")
# plotting data
data_long %>% ggplot() +
geom_line(mapping = aes(x=date,y=Value,color=Trade),size=1) +
labs(title = "International Trade during COVID19 Pandemic",
subtitle = str_glue("Quarterly \nFrom {min(indicator$date)} through {max(indicator$date)}"),
x="Monthly", y="Millions of Dollars",
caption = "Data source: FRED Federal Reserve. Illustration by @JoeLongSanDiego")+
theme_economist()

highchart() %>%
hc_chart(type = "column") %>%
hc_xAxis(categories = indicator$date) %>%
hc_add_series(name="Import",data = indicator$import) %>%
hc_add_series(name="Export",data = indicator$export) %>%
hc_subtitle(text=str_glue("from {min(indicator$date)} through {max(indicator$date)}"), align = "center") %>%
hc_title(text = "U.S. International Trade during COVID19 Pandemic",
style = list(fontWeight = "bold", fontSize = "20px"),
align = "center") %>%
hc_credits(enabled = TRUE,text = "Data Source: FRED Federal Reserve _ Illustration by @JoeLongSanDiego") %>%
hc_yAxis(title = list(text = "Millions of Dollars")) %>%
hc_add_theme(hc_theme_economist())
U.S. Imports of Goods by Customs Basis from Mexico (IMPMX)
U.S. Exports of Goods by F.A.S. Basis to Mexico (EXPMX)
import <-fredr_series_observations(series_id = "IMPMX",
observation_start = as.Date("2019-01-01"))
export <-fredr_series_observations(series_id = "EXPMX",
observation_start = as.Date("2019-01-01"))
indicator <-as.data.frame(import$date)
colnames(indicator) <- "date"
indicator$import <- import$value
indicator$export <- export$value
indicator %>% kable() %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed")) %>%
column_spec(2, T, color = "green" ) %>%
column_spec(3, T, color = "blue") %>%
row_spec(17,T,color = "red",background = "yellow")
date
|
import
|
export
|
2019-01-01
|
27678
|
21973
|
2019-02-01
|
27611
|
20250
|
2019-03-01
|
31264
|
21784
|
2019-04-01
|
30380
|
22301
|
2019-05-01
|
32076
|
22566
|
2019-06-01
|
30473
|
20599
|
2019-07-01
|
30088
|
22146
|
2019-08-01
|
31012
|
22046
|
2019-09-01
|
29523
|
20655
|
2019-10-01
|
31056
|
22316
|
2019-11-01
|
29193
|
20940
|
2019-12-01
|
27617
|
18995
|
2020-01-01
|
28332
|
20834
|
2020-02-01
|
29058
|
19397
|
2020-03-01
|
30107
|
20048
|
2020-04-01
|
15829
|
12528
|
2020-05-01
|
14927
|
10440
|
2020-06-01
|
25804
|
15787
|
data_long <- melt(indicator, id.vars=c("date"))
colnames(data_long) <- c("date","Trade","Value")
# plotting data
data_long %>% ggplot() +
geom_line(mapping = aes(x=date,y=Value,color=Trade),size=1) +
labs(title = "U.S. Trade with Mexico during COVID19 Pandemic",
subtitle = str_glue("From {min(indicator$date)} through {max(indicator$date)}"),
x="Monthly", y="Millions of Dollars",
caption = "Data source: FRED Federal Reserve. Illustration by @JoeLongSanDiego")+
theme_economist()

highchart() %>%
hc_chart(type = "column") %>%
hc_xAxis(categories = indicator$date) %>%
hc_add_series(name="Import",data = indicator$import) %>%
hc_add_series(name="Export",data = indicator$export) %>%
hc_subtitle(text=str_glue("from {min(indicator$date)} through {max(indicator$date)}"), align = "center") %>%
hc_title(text = "U.S. Trade with Mexico during COVID19 Pandemic",
style = list(fontWeight = "bold", fontSize = "20px"),
align = "center") %>%
hc_credits(enabled = TRUE,text = "Data Source: FRED Federal Reserve _ Illustration by @JoeLongSanDiego") %>%
hc_yAxis(title = list(text = "Millions of Dollars")) %>%
hc_add_theme(hc_theme_economist())
U.S. Exports of Goods by F.A.S. Basis to Canada (EXPCA)
U.S. Imports of Goods by Customs Basis from Canada (IMPCA)
import <-fredr_series_observations(series_id = "IMPCA",
observation_start = as.Date("2019-01-01"))
export <-fredr_series_observations(series_id = "EXPCA",
observation_start = as.Date("2019-01-01"))
indicator <-as.data.frame(import$date)
colnames(indicator) <- "date"
indicator$import <- import$value
indicator$export <- export$value
indicator %>% kable() %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed")) %>%
column_spec(2, T, color = "green" ) %>%
column_spec(3, T, color = "blue") %>%
row_spec(16,T,color = "red",background = "yellow")
date
|
import
|
export
|
2019-01-01
|
23389
|
22635
|
2019-02-01
|
23089
|
23171
|
2019-03-01
|
27746
|
26439
|
2019-04-01
|
26761
|
25299
|
2019-05-01
|
29232
|
26150
|
2019-06-01
|
27689
|
24876
|
2019-07-01
|
26798
|
23441
|
2019-08-01
|
26662
|
25317
|
2019-09-01
|
26882
|
24306
|
2019-10-01
|
28567
|
25277
|
2019-11-01
|
25260
|
23432
|
2019-12-01
|
27353
|
22290
|
2020-01-01
|
25381
|
22550
|
2020-02-01
|
24347
|
23219
|
2020-03-01
|
25124
|
23603
|
2020-04-01
|
14976
|
14796
|
2020-05-01
|
15870
|
14761
|
2020-06-01
|
20357
|
20103
|
data_long <- melt(indicator, id.vars=c("date"))
colnames(data_long) <- c("date","Trade","Value")
# plotting data
data_long %>% ggplot() +
geom_line(mapping = aes(x=date,y=Value,color=Trade),size=1) +
labs(title = "U.S. Trade with Canada during COVID19 Pandemic",
subtitle = str_glue("From {min(indicator$date)} through {max(indicator$date)}"),
x="Monthly", y="Millions of Dollars",
caption = "Data source: FRED Federal Reserve. Illustration by @JoeLongSanDiego")+
theme_economist()

highchart() %>%
hc_chart(type = "column") %>%
hc_xAxis(categories = indicator$date) %>%
hc_add_series(name="Import",data = indicator$import) %>%
hc_add_series(name="Export",data = indicator$export) %>%
hc_subtitle(text=str_glue("from {min(indicator$date)} through {max(indicator$date)}"), align = "center") %>%
hc_title(text = "U.S. Trade with Canada during COVID19 Pandemic",
style = list(fontWeight = "bold", fontSize = "20px"),
align = "center") %>%
hc_credits(enabled = TRUE,text = "Data Source: FRED Federal Reserve _ Illustration by @JoeLongSanDiego") %>%
hc_yAxis(title = list(text = "Millions of Dollars")) %>%
hc_add_theme(hc_theme_economist())
### U.S. Imports of Goods by Customs Basis from China (IMPCH) ### U.S. Exports of Goods by F.A.S. Basis to Mainland China (EXPCH)
import <-fredr_series_observations(series_id = "IMPCH",
observation_start = as.Date("2019-01-01"))
export <-fredr_series_observations(series_id = "EXPCH",
observation_start = as.Date("2019-01-01"))
indicator <-as.data.frame(import$date)
colnames(indicator) <- "date"
indicator$import <- import$value
indicator$export <- export$value
indicator %>% kable() %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed")) %>%
column_spec(2, T, color = "green" ) %>%
column_spec(3, T, color = "blue") %>%
row_spec(15,T,color = "red",background = "yellow")
date
|
import
|
export
|
2019-01-01
|
41514
|
7105
|
2019-02-01
|
33155
|
8083
|
2019-03-01
|
31176
|
10575
|
2019-04-01
|
34683
|
7883
|
2019-05-01
|
39173
|
9069
|
2019-06-01
|
38968
|
9167
|
2019-07-01
|
41449
|
8694
|
2019-08-01
|
41151
|
9416
|
2019-09-01
|
40165
|
8597
|
2019-10-01
|
40115
|
8851
|
2019-11-01
|
36437
|
10103
|
2019-12-01
|
33666
|
8903
|
2020-01-01
|
33281
|
7215
|
2020-02-01
|
22813
|
6815
|
2020-03-01
|
19805
|
7972
|
2020-04-01
|
31071
|
8605
|
2020-05-01
|
36598
|
9642
|
2020-06-01
|
37639
|
9242
|
data_long <- melt(indicator, id.vars=c("date"))
colnames(data_long) <- c("date","Trade","Value")
# plotting data
data_long %>% ggplot() +
geom_line(mapping = aes(x=date,y=Value,color=Trade),size=1) +
labs(title = "U.S. Trade with China during COVID19 Pandemic",
subtitle = str_glue("From {min(indicator$date)} through {max(indicator$date)}"),
x="Monthly", y="Millions of Dollars",
caption = "Data source: FRED Federal Reserve. Illustration by @JoeLongSanDiego")+
theme_economist()

highchart() %>%
hc_chart(type = "column") %>%
hc_xAxis(categories = indicator$date) %>%
hc_add_series(name="Import",data = indicator$import) %>%
hc_add_series(name="Export",data = indicator$export) %>%
hc_subtitle(text=str_glue("from {min(indicator$date)} through {max(indicator$date)}"), align = "center") %>%
hc_title(text = "U.S. Trade with China during COVID19 Pandemic",
style = list(fontWeight = "bold", fontSize = "20px"),
align = "center") %>%
hc_credits(enabled = TRUE,text = "Data Source: FRED Federal Reserve _ Illustration by @JoeLongSanDiego") %>%
hc_yAxis(title = list(text = "Millions of Dollars")) %>%
hc_add_theme(hc_theme_economist())
U.S. imports of Goods by F.A.S. Basis to Germany (IMPGE)
U.S. Exports of Goods by F.A.S. Basis to Germany (EXPGE)
import <-fredr_series_observations(series_id = "IMPGE",
observation_start = as.Date("2019-01-01"))
export <-fredr_series_observations(series_id = "EXPGE",
observation_start = as.Date("2019-01-01"))
indicator <-as.data.frame(import$date)
colnames(indicator) <- "date"
indicator$import <- import$value
indicator$export <- export$value
indicator %>% kable() %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed")) %>%
column_spec(2, T, color = "green" ) %>%
column_spec(3, T, color = "blue") %>%
row_spec(17,T,color = "red",background = "yellow")
date
|
import
|
export
|
2019-01-01
|
10301
|
4948
|
2019-02-01
|
9354
|
4856
|
2019-03-01
|
11389
|
5832
|
2019-04-01
|
10744
|
4756
|
2019-05-01
|
10967
|
5134
|
2019-06-01
|
9596
|
4747
|
2019-07-01
|
11414
|
4428
|
2019-08-01
|
12021
|
4882
|
2019-09-01
|
10341
|
5518
|
2019-10-01
|
10705
|
5419
|
2019-11-01
|
10044
|
4764
|
2019-12-01
|
10633
|
4830
|
2020-01-01
|
9783
|
4718
|
2020-02-01
|
9107
|
5019
|
2020-03-01
|
12131
|
6112
|
2020-04-01
|
8438
|
4096
|
2020-05-01
|
7322
|
3690
|
2020-06-01
|
7764
|
3944
|
data_long <- melt(indicator, id.vars=c("date"))
colnames(data_long) <- c("date","Trade","Value")
# plotting data
data_long %>% ggplot() +
geom_line(mapping = aes(x=date,y=Value,color=Trade),size=1) +
labs(title = "U.S. Trade with Germany during COVID19 Pandemic",
subtitle = str_glue("From {min(indicator$date)} through {max(indicator$date)}"),
x="Monthly", y="Millions of Dollars",
caption = "Data source: FRED Federal Reserve. Illustration by @JoeLongSanDiego")+
theme_economist()

highchart() %>%
hc_chart(type = "column") %>%
hc_xAxis(categories = indicator$date) %>%
hc_add_series(name="Import",data = indicator$import) %>%
hc_add_series(name="Export",data = indicator$export) %>%
hc_subtitle(text=str_glue("from {min(indicator$date)} through {max(indicator$date)}"), align = "center") %>%
hc_title(text = "U.S. Trade with Germany during COVID19 Pandemic",
style = list(fontWeight = "bold", fontSize = "20px"),
align = "center") %>%
hc_credits(enabled = TRUE,text = "Data Source: FRED Federal Reserve _ Illustration by @JoeLongSanDiego") %>%
hc_yAxis(title = list(text = "Millions of Dollars")) %>%
hc_add_theme(hc_theme_economist())
U.S. Imports of Goods by Customs Basis from Brazil (IMP3510)
U.S. Exports of Goods by F.A.S. Basis to Brazil (EXP3510)
import <-fredr_series_observations(series_id = "IMP3510",
observation_start = as.Date("2019-01-01"))
export <-fredr_series_observations(series_id = "EXP3510",
observation_start = as.Date("2019-01-01"))
indicator <-as.data.frame(import$date)
colnames(indicator) <- "date"
indicator$import <- import$value
indicator$export <- export$value
indicator %>% kable() %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed")) %>%
column_spec(2, T, color = "green" ) %>%
column_spec(3, T, color = "blue") %>%
row_spec(14,T,color = "red",background = "yellow")
date
|
import
|
export
|
2019-01-01
|
2549
|
3340
|
2019-02-01
|
2204
|
2966
|
2019-03-01
|
2569
|
3680
|
2019-04-01
|
2555
|
3273
|
2019-05-01
|
3019
|
3539
|
2019-06-01
|
2621
|
3884
|
2019-07-01
|
3087
|
3589
|
2019-08-01
|
2410
|
3715
|
2019-09-01
|
2439
|
3527
|
2019-10-01
|
2395
|
3847
|
2019-11-01
|
2386
|
4035
|
2019-12-01
|
2610
|
3456
|
2020-01-01
|
2083
|
3481
|
2020-02-01
|
1573
|
3319
|
2020-03-01
|
2019
|
3545
|
2020-04-01
|
1663
|
2345
|
2020-05-01
|
1761
|
2279
|
2020-06-01
|
1916
|
2198
|
data_long <- melt(indicator, id.vars=c("date"))
colnames(data_long) <- c("date","Trade","Value")
# plotting data
data_long %>% ggplot() +
geom_line(mapping = aes(x=date,y=Value,color=Trade),size=1) +
labs(title = "U.S. Trade with Brazil during COVID19 Pandemic",
subtitle = str_glue("From {min(indicator$date)} through {max(indicator$date)}"),
x="Monthly", y="Millions of Dollars",
caption = "Data source: FRED Federal Reserve. Illustration by @JoeLongSanDiego")+
theme_economist()

highchart() %>%
hc_chart(type = "column") %>%
hc_xAxis(categories = indicator$date) %>%
hc_add_series(name="Import",data = indicator$import) %>%
hc_add_series(name="Export",data = indicator$export) %>%
hc_subtitle(text=str_glue("From {min(indicator$date)} through {max(indicator$date)}"), align = "center") %>%
hc_title(text = "U.S. Trade with Brazil during COVID19 Pandemic",
style = list(fontWeight = "bold", fontSize = "20px"),
align = "center") %>%
hc_credits(enabled = TRUE,text = "Data Source: FRED Federal Reserve _ Illustration by @JoeLongSanDiego") %>%
hc_yAxis(title = list(text = "Millions of Dollars")) %>%
hc_add_theme(hc_theme_economist())
U.S. Imports of Goods by Customs Basis from Turkey (IMP4890)
U.S. Exports of Goods by F.A.S. Basis to Turkey (EXP4890)
import <-fredr_series_observations(series_id = "IMP4890",
observation_start = as.Date("2019-01-01"))
export <-fredr_series_observations(series_id = "EXP4890",
observation_start = as.Date("2019-01-01"))
indicator <-as.data.frame(import$date)
colnames(indicator) <- "date"
indicator$import <- import$value
indicator$export <- export$value
indicator %>% kable() %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed")) %>%
column_spec(2, T, color = "green" ) %>%
column_spec(3, T, color = "blue") %>%
row_spec(17:18,T,color = "red",background = "yellow")
date
|
import
|
export
|
2019-01-01
|
942.2
|
630.8
|
2019-02-01
|
712.6
|
886.6
|
2019-03-01
|
922.0
|
883.9
|
2019-04-01
|
840.4
|
700.1
|
2019-05-01
|
913.3
|
841.4
|
2019-06-01
|
803.1
|
1010.1
|
2019-07-01
|
887.0
|
1134.8
|
2019-08-01
|
991.2
|
840.9
|
2019-09-01
|
950.6
|
769.0
|
2019-10-01
|
904.5
|
775.2
|
2019-11-01
|
903.5
|
744.0
|
2019-12-01
|
860.4
|
816.1
|
2020-01-01
|
850.9
|
1175.7
|
2020-02-01
|
849.1
|
1156.3
|
2020-03-01
|
943.6
|
1257.2
|
2020-04-01
|
781.4
|
649.9
|
2020-05-01
|
1055.6
|
585.4
|
2020-06-01
|
738.0
|
642.8
|
data_long <- melt(indicator, id.vars=c("date"))
colnames(data_long) <- c("date","Trade","Value")
# plotting data
data_long %>% ggplot() +
geom_line(mapping = aes(x=date,y=Value,color=Trade),size=1) +
labs(title = "U.S. Trade with Turkey during COVID19 Pandemic",
subtitle = str_glue("From {min(indicator$date)} through {max(indicator$date)}"),
x="Monthly", y="Millions of Dollars",
caption = "Data source: FRED Federal Reserve. Illustration by @JoeLongSanDiego")+
theme_economist()

highchart() %>%
hc_chart(type = "column") %>%
hc_xAxis(categories = indicator$date) %>%
hc_add_series(name="Import",data = indicator$import) %>%
hc_add_series(name="Export",data = indicator$export) %>%
hc_subtitle(text=str_glue("From {min(indicator$date)} through {max(indicator$date)}"), align = "center") %>%
hc_title(text = "U.S. Trade with Turkey during COVID19 Pandemic",
style = list(fontWeight = "bold", fontSize = "20px"),
align = "center") %>%
hc_credits(enabled = TRUE,text = "Data Source: FRED Federal Reserve _ Illustration by @JoeLongSanDiego") %>%
hc_yAxis(title = list(text = "Millions of Dollars")) %>%
hc_add_theme(hc_theme_economist())
U.S. Imports of Goods by Customs Basis from Greece (IMP4840)
U.S. Exports of Goods by F.A.S. Basis to Greece (EXP4840)
import <-fredr_series_observations(series_id = "IMP4840",
observation_start = as.Date("2019-01-01"))
export <-fredr_series_observations(series_id = "EXP4840",
observation_start = as.Date("2019-01-01"))
indicator <-as.data.frame(import$date)
colnames(indicator) <- "date"
indicator$import <- import$value
indicator$export <- export$value
indicator %>% kable() %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed")) %>%
column_spec(2, T, color = "green" ) %>%
column_spec(3, T, color = "blue") %>%
row_spec(16:17,T,color = "red",background = "yellow")
date
|
import
|
export
|
2019-01-01
|
138.65
|
90.43
|
2019-02-01
|
92.28
|
113.77
|
2019-03-01
|
122.58
|
94.73
|
2019-04-01
|
119.35
|
121.24
|
2019-05-01
|
122.07
|
101.67
|
2019-06-01
|
154.13
|
148.94
|
2019-07-01
|
189.24
|
140.48
|
2019-08-01
|
119.87
|
85.17
|
2019-09-01
|
122.99
|
83.53
|
2019-10-01
|
132.69
|
123.99
|
2019-11-01
|
97.05
|
111.72
|
2019-12-01
|
101.99
|
226.58
|
2020-01-01
|
119.84
|
179.02
|
2020-02-01
|
85.63
|
139.91
|
2020-03-01
|
145.57
|
200.18
|
2020-04-01
|
110.84
|
65.90
|
2020-05-01
|
85.35
|
108.42
|
2020-06-01
|
99.71
|
87.96
|
data_long <- melt(indicator, id.vars=c("date"))
colnames(data_long) <- c("date","Trade","Value")
# plotting data
data_long %>% ggplot() +
geom_line(mapping = aes(x=date,y=Value,color=Trade),size=1) +
labs(title = "U.S. Trade with Greece during COVID19 Pandemic",
subtitle = str_glue("From {min(indicator$date)} through {max(indicator$date)}"),
x="Monthly", y="Millions of Dollars",
caption = "Data source: FRED Federal Reserve. Illustration by @JoeLongSanDiego")+
theme_economist()

highchart() %>%
hc_chart(type = "column") %>%
hc_xAxis(categories = indicator$date) %>%
hc_add_series(name="Import",data = indicator$import) %>%
hc_add_series(name="Export",data = indicator$export) %>%
hc_subtitle(text=str_glue("From {min(indicator$date)} through {max(indicator$date)}"), align = "center") %>%
hc_title(text = "U.S. Trade with Greece during COVID19 Pandemic",
style = list(fontWeight = "bold", fontSize = "20px"),
align = "center") %>%
hc_credits(enabled = TRUE,text = "Data Source: FRED Federal Reserve _ Illustration by @JoeLongSanDiego") %>%
hc_yAxis(title = list(text = "Millions of Dollars")) %>%
hc_add_theme(hc_theme_economist())