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
tail(indicator,12) %>% kable() %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed")) %>%
column_spec(2, T, color = "red" ) %>%
column_spec(3, T, color = "blue")
|
date
|
import
|
export
|
24
|
2020-12-01
|
256678
|
190877
|
25
|
2021-01-01
|
260101
|
194405
|
26
|
2021-02-01
|
258619
|
190439
|
27
|
2021-03-01
|
277182
|
204960
|
28
|
2021-04-01
|
273724
|
207573
|
29
|
2021-05-01
|
277524
|
209549
|
30
|
2021-06-01
|
283460
|
210524
|
31
|
2021-07-01
|
282756
|
212422
|
32
|
2021-08-01
|
286399
|
213204
|
33
|
2021-09-01
|
288232
|
206796
|
34
|
2021-10-01
|
291014
|
223856
|
35
|
2021-11-01
|
304388
|
224215
|
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 St. Louis 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
|
3131
|
2525
|
2019-04-01
|
3166
|
2533
|
2019-07-01
|
3126
|
2512
|
2019-10-01
|
3041
|
2509
|
2020-01-01
|
2927
|
2386
|
2020-04-01
|
2347
|
1808
|
2020-07-01
|
2805
|
2080
|
2020-10-01
|
3019
|
2221
|
2021-01-01
|
3184
|
2312
|
2021-04-01
|
3343
|
2462
|
2021-07-01
|
3432
|
2485
|
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 St. Louis Federal Reserve\nIllustration 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(20:21,T,color = "red",background = "yellow")
date
|
import
|
export
|
2019-01-01
|
27561
|
21986
|
2019-02-01
|
27507
|
20216
|
2019-03-01
|
31102
|
21722
|
2019-04-01
|
30235
|
22268
|
2019-05-01
|
31919
|
22645
|
2019-06-01
|
30198
|
20683
|
2019-07-01
|
29961
|
22213
|
2019-08-01
|
30891
|
21941
|
2019-09-01
|
29285
|
20617
|
2019-10-01
|
30940
|
22272
|
2019-11-01
|
29048
|
20802
|
2019-12-01
|
27507
|
18951
|
2020-01-01
|
28300
|
20754
|
2020-02-01
|
29037
|
19171
|
2020-03-01
|
30081
|
19685
|
2020-04-01
|
15817
|
12414
|
2020-05-01
|
14914
|
10404
|
2020-06-01
|
25807
|
15712
|
2020-07-01
|
29070
|
18472
|
2020-08-01
|
29772
|
16999
|
2020-09-01
|
29857
|
18715
|
2020-10-01
|
33113
|
20443
|
2020-11-01
|
29865
|
19257
|
2020-12-01
|
29580
|
19456
|
2021-01-01
|
29041
|
19483
|
2021-02-01
|
27428
|
21046
|
2021-03-01
|
33399
|
23509
|
2021-04-01
|
32177
|
22558
|
2021-05-01
|
31371
|
22800
|
2021-06-01
|
33024
|
24134
|
2021-07-01
|
31908
|
23661
|
2021-08-01
|
32088
|
24181
|
2021-09-01
|
32048
|
22784
|
2021-10-01
|
34358
|
24473
|
2021-11-01
|
34622
|
24089
|
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 St. Louis 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(20:21,T,color = "red",background = "yellow")
date
|
import
|
export
|
2019-01-01
|
23351
|
22683
|
2019-02-01
|
22961
|
23191
|
2019-03-01
|
27572
|
26448
|
2019-04-01
|
26733
|
25334
|
2019-05-01
|
29197
|
26158
|
2019-06-01
|
27646
|
24887
|
2019-07-01
|
26762
|
23465
|
2019-08-01
|
26636
|
25309
|
2019-09-01
|
26853
|
24307
|
2019-10-01
|
28537
|
25267
|
2019-11-01
|
25242
|
23430
|
2019-12-01
|
27286
|
22340
|
2020-01-01
|
25321
|
22551
|
2020-02-01
|
24361
|
23210
|
2020-03-01
|
25099
|
23575
|
2020-04-01
|
14955
|
14736
|
2020-05-01
|
15850
|
14830
|
2020-06-01
|
20335
|
20116
|
2020-07-01
|
22340
|
21265
|
2020-08-01
|
23762
|
22841
|
2020-09-01
|
24606
|
23336
|
2020-10-01
|
24878
|
23616
|
2020-11-01
|
24087
|
22431
|
2020-12-01
|
24719
|
22884
|
2021-01-01
|
24542
|
21350
|
2021-02-01
|
25216
|
22298
|
2021-03-01
|
29798
|
27985
|
2021-04-01
|
27470
|
25120
|
2021-05-01
|
29083
|
25432
|
2021-06-01
|
32127
|
26666
|
2021-07-01
|
29979
|
25695
|
2021-08-01
|
31069
|
25774
|
2021-09-01
|
29791
|
24639
|
2021-10-01
|
31280
|
27472
|
2021-11-01
|
33753
|
27631
|
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(20:21,T,color = "red",background = "yellow")
date
|
import
|
export
|
2019-01-01
|
41369
|
7104
|
2019-02-01
|
33101
|
8083
|
2019-03-01
|
31187
|
10577
|
2019-04-01
|
34625
|
7884
|
2019-05-01
|
39104
|
9070
|
2019-06-01
|
38871
|
9167
|
2019-07-01
|
41377
|
8699
|
2019-08-01
|
41080
|
9409
|
2019-09-01
|
40061
|
8600
|
2019-10-01
|
40000
|
8854
|
2019-11-01
|
36398
|
10103
|
2019-12-01
|
33586
|
8899
|
2020-01-01
|
33173
|
7154
|
2020-02-01
|
22721
|
6828
|
2020-03-01
|
19789
|
7900
|
2020-04-01
|
30923
|
8624
|
2020-05-01
|
36552
|
9672
|
2020-06-01
|
37495
|
9237
|
2020-07-01
|
40658
|
9088
|
2020-08-01
|
40792
|
10962
|
2020-09-01
|
41194
|
11498
|
2020-10-01
|
44779
|
14773
|
2020-11-01
|
44839
|
14220
|
2020-12-01
|
41834
|
14530
|
2021-01-01
|
39111
|
12861
|
2021-02-01
|
34027
|
9410
|
2021-03-01
|
40229
|
12542
|
2021-04-01
|
37590
|
11760
|
2021-05-01
|
38732
|
12411
|
2021-06-01
|
39946
|
12102
|
2021-07-01
|
40368
|
11720
|
2021-08-01
|
42997
|
11259
|
2021-09-01
|
47414
|
10911
|
2021-10-01
|
48032
|
16635
|
2021-11-01
|
48385
|
16069
|
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(20:21,T,color = "red",background = "yellow")
date
|
import
|
export
|
2019-01-01
|
10247
|
4938
|
2019-02-01
|
9372
|
4859
|
2019-03-01
|
11391
|
5825
|
2019-04-01
|
10764
|
4746
|
2019-05-01
|
10941
|
5131
|
2019-06-01
|
9604
|
4747
|
2019-07-01
|
11354
|
4425
|
2019-08-01
|
12024
|
4877
|
2019-09-01
|
10387
|
5514
|
2019-10-01
|
10697
|
5427
|
2019-11-01
|
9988
|
4758
|
2019-12-01
|
10740
|
4822
|
2020-01-01
|
9800
|
4693
|
2020-02-01
|
9118
|
4996
|
2020-03-01
|
12159
|
6056
|
2020-04-01
|
8472
|
4019
|
2020-05-01
|
7266
|
3654
|
2020-06-01
|
7741
|
3956
|
2020-07-01
|
8762
|
4824
|
2020-08-01
|
9774
|
4789
|
2020-09-01
|
10799
|
5468
|
2020-10-01
|
10379
|
5297
|
2020-11-01
|
9844
|
4859
|
2020-12-01
|
10955
|
4822
|
2021-01-01
|
10844
|
4517
|
2021-02-01
|
9248
|
4887
|
2021-03-01
|
11510
|
5741
|
2021-04-01
|
11128
|
5622
|
2021-05-01
|
11172
|
5382
|
2021-06-01
|
11556
|
5829
|
2021-07-01
|
11338
|
5218
|
2021-08-01
|
12230
|
5579
|
2021-09-01
|
11029
|
5432
|
2021-10-01
|
11734
|
6110
|
2021-11-01
|
11783
|
5322
|
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(20:21,T,color = "red",background = "yellow")
date
|
import
|
export
|
2019-01-01
|
2547
|
3351
|
2019-02-01
|
2289
|
2964
|
2019-03-01
|
2579
|
3674
|
2019-04-01
|
2477
|
3271
|
2019-05-01
|
3097
|
3538
|
2019-06-01
|
2611
|
3883
|
2019-07-01
|
3096
|
3588
|
2019-08-01
|
2410
|
3715
|
2019-09-01
|
2439
|
3525
|
2019-10-01
|
2390
|
3851
|
2019-11-01
|
2400
|
4048
|
2019-12-01
|
2600
|
3459
|
2020-01-01
|
2093
|
3547
|
2020-02-01
|
1554
|
3166
|
2020-03-01
|
2122
|
3426
|
2020-04-01
|
1678
|
2297
|
2020-05-01
|
1763
|
2233
|
2020-06-01
|
1909
|
2171
|
2020-07-01
|
1926
|
2595
|
2020-08-01
|
1703
|
2768
|
2020-09-01
|
1800
|
2877
|
2020-10-01
|
2302
|
3087
|
2020-11-01
|
1948
|
3064
|
2020-12-01
|
2599
|
3365
|
2021-01-01
|
1782
|
3125
|
2021-02-01
|
1694
|
2988
|
2021-03-01
|
2157
|
3221
|
2021-04-01
|
2344
|
3408
|
2021-05-01
|
2433
|
3594
|
2021-06-01
|
2841
|
4161
|
2021-07-01
|
3052
|
4318
|
2021-08-01
|
2805
|
4887
|
2021-09-01
|
3279
|
4464
|
2021-10-01
|
3006
|
4615
|
2021-11-01
|
2863
|
4001
|
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(20:21,T,color = "red",background = "yellow")
date
|
import
|
export
|
2019-01-01
|
938.4
|
630.7
|
2019-02-01
|
710.5
|
886.6
|
2019-03-01
|
919.5
|
884.0
|
2019-04-01
|
836.9
|
695.0
|
2019-05-01
|
910.3
|
846.8
|
2019-06-01
|
797.5
|
1008.9
|
2019-07-01
|
888.2
|
1134.8
|
2019-08-01
|
986.5
|
840.8
|
2019-09-01
|
947.5
|
769.1
|
2019-10-01
|
902.9
|
774.6
|
2019-11-01
|
898.3
|
744.6
|
2019-12-01
|
856.5
|
815.4
|
2020-01-01
|
848.0
|
1162.7
|
2020-02-01
|
846.2
|
1176.4
|
2020-03-01
|
943.7
|
1270.5
|
2020-04-01
|
783.7
|
637.9
|
2020-05-01
|
1050.0
|
566.6
|
2020-06-01
|
733.3
|
639.5
|
2020-07-01
|
875.4
|
826.5
|
2020-08-01
|
906.6
|
673.1
|
2020-09-01
|
968.5
|
874.8
|
2020-10-01
|
1093.8
|
692.6
|
2020-11-01
|
932.3
|
776.6
|
2020-12-01
|
1019.3
|
688.9
|
2021-01-01
|
1117.7
|
796.4
|
2021-02-01
|
998.0
|
744.2
|
2021-03-01
|
1157.5
|
902.6
|
2021-04-01
|
1459.8
|
796.4
|
2021-05-01
|
1330.2
|
727.9
|
2021-06-01
|
1423.9
|
1067.6
|
2021-07-01
|
1456.0
|
787.1
|
2021-08-01
|
1293.9
|
865.0
|
2021-09-01
|
1375.9
|
1186.9
|
2021-10-01
|
1459.9
|
1121.1
|
2021-11-01
|
1383.0
|
1366.7
|
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(20:21,T,color = "red",background = "yellow")
date
|
import
|
export
|
2019-01-01
|
138.51
|
90.43
|
2019-02-01
|
92.07
|
113.77
|
2019-03-01
|
122.58
|
94.73
|
2019-04-01
|
119.36
|
121.24
|
2019-05-01
|
122.06
|
101.67
|
2019-06-01
|
154.12
|
148.98
|
2019-07-01
|
189.23
|
140.60
|
2019-08-01
|
119.85
|
85.17
|
2019-09-01
|
123.01
|
83.53
|
2019-10-01
|
132.87
|
123.99
|
2019-11-01
|
97.14
|
111.72
|
2019-12-01
|
102.31
|
226.26
|
2020-01-01
|
106.84
|
177.46
|
2020-02-01
|
98.99
|
137.73
|
2020-03-01
|
145.39
|
192.86
|
2020-04-01
|
104.34
|
65.79
|
2020-05-01
|
91.83
|
108.51
|
2020-06-01
|
99.70
|
87.99
|
2020-07-01
|
97.89
|
94.35
|
2020-08-01
|
114.00
|
67.56
|
2020-09-01
|
119.40
|
145.98
|
2020-10-01
|
100.32
|
82.57
|
2020-11-01
|
88.80
|
107.31
|
2020-12-01
|
131.88
|
105.63
|
2021-01-01
|
107.27
|
83.91
|
2021-02-01
|
118.18
|
115.94
|
2021-03-01
|
140.39
|
136.36
|
2021-04-01
|
136.14
|
140.59
|
2021-05-01
|
138.93
|
143.68
|
2021-06-01
|
163.53
|
97.70
|
2021-07-01
|
161.95
|
155.90
|
2021-08-01
|
159.14
|
111.33
|
2021-09-01
|
130.49
|
86.17
|
2021-10-01
|
126.57
|
164.16
|
2021-11-01
|
155.55
|
179.11
|
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())
U.S. Imports of Goods by Customs Basis from Vietnam (IMP5520)
U.S. Exports of Goods by F.A.S. Basis to Vietnam (EXP5520)
import <-fredr_series_observations(series_id = "IMP5520",
observation_start = as.Date("2019-01-01"))
export <-fredr_series_observations(series_id = "EXP5520",
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(20:21,T,color = "red",background = "yellow")
date
|
import
|
export
|
2019-01-01
|
5361
|
690.6
|
2019-02-01
|
5316
|
727.3
|
2019-03-01
|
5259
|
1029.2
|
2019-04-01
|
4707
|
889.6
|
2019-05-01
|
5130
|
879.3
|
2019-06-01
|
4580
|
860.4
|
2019-07-01
|
5516
|
801.8
|
2019-08-01
|
6801
|
1368.0
|
2019-09-01
|
6165
|
820.1
|
2019-10-01
|
6363
|
1066.6
|
2019-11-01
|
5493
|
811.5
|
2019-12-01
|
5769
|
877.2
|
2020-01-01
|
6128
|
877.5
|
2020-02-01
|
6032
|
928.9
|
2020-03-01
|
5183
|
1057.7
|
2020-04-01
|
5002
|
776.0
|
2020-05-01
|
4846
|
670.2
|
2020-06-01
|
5870
|
671.6
|
2020-07-01
|
7532
|
772.2
|
2020-08-01
|
8372
|
789.2
|
2020-09-01
|
7926
|
811.6
|
2020-10-01
|
7945
|
790.9
|
2020-11-01
|
7870
|
818.4
|
2020-12-01
|
6912
|
947.7
|
2021-01-01
|
7661
|
882.0
|
2021-02-01
|
6760
|
978.8
|
2021-03-01
|
8801
|
998.0
|
2021-04-01
|
7953
|
934.9
|
2021-05-01
|
8561
|
1078.5
|
2021-06-01
|
8097
|
863.9
|
2021-07-01
|
8230
|
908.5
|
2021-08-01
|
9367
|
956.8
|
2021-09-01
|
8331
|
674.9
|
2021-10-01
|
9195
|
789.7
|
2021-11-01
|
9371
|
893.9
|
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 Vietnam during COVID19 Pandemic",
subtitle = str_glue("From {min(indicator$date)} through {max(indicator$date)}"),
x="Monthly", y="Millions of Dollars",
caption = "Data source: FRED St. Louis Federal Reserve\nIllustration 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 Vietnam during COVID19 Pandemic",
style = list(fontWeight = "bold", fontSize = "20px"),
align = "center") %>%
hc_credits(enabled = TRUE,text = "Data Source: FRED St. Louis Federal Reserve\n Illustration by @JoeLongSanDiego") %>%
hc_yAxis(title = list(text = "Millions of Dollars")) %>%
hc_add_theme(hc_theme_economist())