Project Background

In 1979, U.S. and China reestablished diplomatic relations, and signed a bilateral trade agreement(Nagashybayeva 2019). China is one of the largest partners of the U.S. , followed by Mexico and Canada. In July 2018, the former U.S. president Trump placed tariff on around $550 billion of imports from China that including cars, hard disks and aircraft parts. China also retaliates by imposing tariff on 545 goods originating from U.S. that worth $185 billion, and the situation has not improved significantly until March 2022 (Mullen 2021). Biden administration has come under pressure from lawmakers, and the business community saying that the tariffs were hurting American companies and consumers.Key business leaders have express frustration with the trade policy and urge the administration to drop the Chinese tariffs and provide more clarity about economic engagement between the world’s biggest economics(Ngo 2022). On March 23rd, Biden administration finally announced that it will reinstates 352 of the 549 eligible exemptions, keeping them in place through end of 2022(Ngo 2022).

Data Source

The project will focus on visualizations and explanatory analysis. The visualization will be presented with the R package - ggplot2. therefore, the analysis will be done by the program language R as well.

The dataset is obtained from the United States Census Bereau, and will be uploaded to my github storage for easy access. There are three datasets will be used in this analysis, the “Trade in Goods with China” data (https://www.census.gov/foreign-trade/balance/c5700.html), and the “U.S. International Trade in Goods and Services” data(https://www.census.gov/foreign-trade/Press-Release/current_press_release/index.html) , and the USDCNY exchange rate data from(https://www.macrotrends.net/2575/us-dollar-yuan-exchange-rate-historical-chart) “Trade in Goods with China” data has the historical record of import, export and balance for both and China and U.S. It allows me make visualizations of the trend of trading for both countries, also can observe the trade deficit or trade surplus from the trade. The “U.S. International Trade in Goods and Services” data categorized the commodities in to 6. The categorized variables are including Foods&Beverages, Industrial Supplies, Capital Goods, Automotive Vehicles, Consumer Goods, Other Goods. From these record, the graph can provide the information of what category of the goods do U.S. and China relies on each other the mostly. Compare the degree of goods that China relies on U.S. and the items that exempted by Biden Administration,it is able to find out weather the new tariff exemptions from Biden Administration on Chinese goods can really solve the problem of international trade beteen U.S. and China.

Project Object and Task Overview

The Object of this project is analyze and present the meaningful insight of the international trade relationship between U.S. and China, and the current trading situations.

  1. Present the historical to current import, export, and trade balance graph to analyze if the section 301 (tariff on Chinese goods) effective or not.

  2. present the import and export categories to verify what categories of product do U.S. trade with China.

  3. Present the historical to current exchange rate, between U.S. and China to compare which country is more beneficial from the trade(the exchange rate is the key of win from trade for China).

  4. Make visualization of the indirectly benefited country - Mexico (Mexico benefited indirectly from the trade war between U.S. and China, since Mexico can be a good alternative of China as the manufacture house)

Libraries

library(ggplot2)
library(readxl)
library(rvest)
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ tibble  3.1.6     ✓ dplyr   1.0.8
## ✓ tidyr   1.2.0     ✓ stringr 1.4.0
## ✓ readr   2.1.2     ✓ forcats 0.5.1
## ✓ purrr   0.3.4
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter()         masks stats::filter()
## x readr::guess_encoding() masks rvest::guess_encoding()
## x dplyr::lag()            masks stats::lag()
library(dplyr)
library(DataExplorer)
library(lubridate)
## 
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
## 
##     date, intersect, setdiff, union

Import Data & Feature Engineering

# export category data and change the column names
data<-read_excel('exh10.xlsx')
## New names:
## * `` -> ...1
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * ...
us_export<-data[10:23,]
colnames(us_export)<-c('period','total','food_beverage','industrial_sup','capital_goods','vehicles','consumer_goods','others','residual')

# import category data and change the column names
us_import<-data[40:53,]
colnames(us_import)<-c('period','total','food_beverage','industrial_sup','capital_goods','vehicles','consumer_goods','others','residual')

# import and filter China, Mexico data
us_china_monthly<-read_excel('country.xlsx')

us_china_bymonth<-us_china_monthly%>%
  filter(CTYNAME=='China')
us_china_bymonth<-us_china_bymonth[-38,-2]
us_china_bymonth$deficit<-us_china_bymonth$IYR-us_china_bymonth$EYR

us_mex_bymonth<-us_china_monthly%>%
  filter(CTYNAME=='Mexico')
us_mex_bymonth<-us_mex_bymonth[-38,-2]
us_mex_bymonth$deficit<-us_mex_bymonth$IYR-us_mex_bymonth$EYR


# historical exchange rate data
exchange_rate<-read.csv('dollar.csv')
str(exchange_rate)
## 'data.frame':    10580 obs. of  2 variables:
##  $ date : chr  "1/2/81" "1/5/81" "1/6/81" "1/7/81" ...
##  $ value: num  1.53 1.54 1.53 1.53 1.53 1.54 1.54 1.54 1.54 1.54 ...
exchange_rate$date<-mdy(exchange_rate$date)
names(exchange_rate)[2]<-'USDtoCNY'
exchange_rate<-exchange_rate %>%
  mutate(CNYtoUSD = 1/USDtoCNY)

Statistic Summary

The summary() functions show that the values in us_import and us_export data sets are in string type, therefore converted to numeric before analyzing the data. Also, No missing values have found within the data sets.

summary(us_export)
##     period             total           food_beverage      industrial_sup    
##  Length:14          Length:14          Length:14          Length:14         
##  Class :character   Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character   Mode  :character  
##  capital_goods        vehicles         consumer_goods        others         
##  Length:14          Length:14          Length:14          Length:14         
##  Class :character   Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character   Mode  :character  
##    residual        
##  Length:14         
##  Class :character  
##  Mode  :character
us_export[,2:9] <- lapply(us_export[,2:9], function(x) as.numeric(as.character(x)))
str(us_export)
## tibble [14 × 9] (S3: tbl_df/tbl/data.frame)
##  $ period        : chr [1:14] "Jan. - Dec. (R)" "Jan. - (R)" "January (R)" "February (R)" ...
##  $ total         : num [1:14] 1755233 145304 145304 138121 148111 ...
##  $ food_beverage : num [1:14] 153441 14484 14484 13843 13578 ...
##  $ industrial_sup: num [1:14] 668282 55975 55975 54054 57323 ...
##  $ capital_goods : num [1:14] 515444 41554 41554 39102 42360 ...
##  $ vehicles      : num [1:14] 140205 12352 12352 11527 12628 ...
##  $ consumer_goods: num [1:14] 231437 16816 16816 15874 17870 ...
##  $ others        : num [1:14] 67191 5596 5596 5263 5985 ...
##  $ residual      : num [1:14] -20767 -1474 -1474 -1542 -1634 ...
plot_missing(us_export)

summary(us_import)
##     period             total           food_beverage      industrial_sup    
##  Length:14          Length:14          Length:14          Length:14         
##  Class :character   Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character   Mode  :character  
##  capital_goods        vehicles         consumer_goods        others         
##  Length:14          Length:14          Length:14          Length:14         
##  Class :character   Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character   Mode  :character  
##    residual        
##  Length:14         
##  Class :character  
##  Mode  :character
us_import[,2:9] <- lapply(us_import[,2:9], function(x) as.numeric(as.character(x)))
str(us_import)
## tibble [14 × 9] (S3: tbl_df/tbl/data.frame)
##  $ period        : chr [1:14] "Jan. - Dec. (R)" "Jan. - (R)" "January (R)" "February (R)" ...
##  $ total         : num [1:14] 2990286 243024 243024 238583 253210 ...
##  $ food_beverage : num [1:14] 160588 13085 13085 12239 12801 ...
##  $ industrial_sup: num [1:14] 723358 56248 56248 58339 59950 ...
##  $ capital_goods : num [1:14] 813005 64272 64272 64373 68137 ...
##  $ vehicles      : num [1:14] 354856 32836 32836 29012 31299 ...
##  $ consumer_goods: num [1:14] 768322 63500 63500 61571 66670 ...
##  $ others        : num [1:14] 121285 8692 8692 9465 10226 ...
##  $ residual      : num [1:14] 48872 4390 4390 3583 4127 ...
plot_missing(us_import)

summary(us_china_bymonth)
##      year             CTYNAME               IJAN              IFEB      
##  Length:37          Length:37          Min.   :  293.1   Min.   :  281  
##  Class :character   Class :character   1st Qu.: 2763.1   1st Qu.: 2499  
##  Mode  :character   Mode  :character   Median :11403.5   Median : 9630  
##                                        Mean   :17378.9   Mean   :14756  
##                                        3rd Qu.:33173.3   3rd Qu.:27245  
##                                        Max.   :45681.3   Max.   :38956  
##       IMAR            IAPR              IMAY              IJUN        
##  Min.   :  293   Min.   :  264.9   Min.   :  295.1   Min.   :  348.7  
##  1st Qu.: 2183   1st Qu.: 2491.6   1st Qu.: 2979.0   1st Qu.: 3463.3  
##  Median :10110   Median :11521.9   Median :11884.7   Median :12127.3  
##  Mean   :14981   Mean   :16229.9   Mean   :17686.0   Mean   :18460.4  
##  3rd Qu.:27294   3rd Qu.:30922.8   3rd Qu.:34937.8   3rd Qu.:35886.0  
##  Max.   :41137   Max.   :38227.8   Max.   :43866.6   Max.   :44524.0  
##       IJUL              IAUG              ISEP              IOCT        
##  Min.   :  344.4   Min.   :  311.8   Min.   :  391.8   Min.   :  385.5  
##  1st Qu.: 3645.4   1st Qu.: 4165.8   1st Qu.: 4134.4   1st Qu.: 4101.2  
##  Median :13438.6   Median :13764.9   Median :14747.5   Median :16458.3  
##  Mean   :19338.9   Mean   :20079.0   Mean   :20596.3   Mean   :21343.5  
##  3rd Qu.:37930.8   3rd Qu.:37374.1   3rd Qu.:37891.8   3rd Qu.:40000.2  
##  Max.   :47009.8   Max.   :47796.2   Max.   :49938.1   Max.   :52081.1  
##       INOV              IDEC              IYR              EJAN        
##  Min.   :  327.5   Min.   :  306.5   Min.   :  3862   Min.   :  213.3  
##  1st Qu.: 3534.3   1st Qu.: 2826.5   1st Qu.: 38787   1st Qu.:  620.7  
##  Median :14157.0   Median :13192.8   Median :152436   Median : 2069.8  
##  Mean   :20142.6   Mean   :18514.2   Mean   :219506   Mean   : 3909.9  
##  3rd Qu.:36764.9   3rd Qu.:33586.2   3rd Qu.:425619   3rd Qu.: 7153.7  
##  Max.   :48385.0   Max.   :49534.7   Max.   :538514   Max.   :12860.9  
##       EFEB             EMAR              EAPR              EMAY        
##  Min.   : 212.7   Min.   :  207.6   Min.   :  265.6   Min.   :  228.7  
##  1st Qu.: 877.9   1st Qu.:  783.7   1st Qu.:  728.4   1st Qu.:  757.3  
##  Median :2048.7   Median : 2423.1   Median : 2121.9   Median : 1984.3  
##  Mean   :3893.1   Mean   : 4471.7   Mean   : 4028.5   Mean   : 4153.2  
##  3rd Qu.:8080.5   3rd Qu.: 8925.6   3rd Qu.: 8000.5   3rd Qu.: 8542.0  
##  Max.   :9750.7   Max.   :12653.0   Max.   :11759.9   Max.   :12411.3  
##       EJUN              EJUL              EAUG              ESEP        
##  Min.   :  261.8   Min.   :  198.6   Min.   :  235.6   Min.   :  216.4  
##  1st Qu.:  771.6   1st Qu.:  970.4   1st Qu.:  778.3   1st Qu.:  753.4  
##  Median : 2205.9   Median : 2067.4   Median : 2034.4   Median : 2091.0  
##  Mean   : 4240.2   Mean   : 4181.1   Mean   : 4295.5   Mean   : 4247.5  
##  3rd Qu.: 8478.1   3rd Qu.: 8515.1   3rd Qu.: 8613.3   3rd Qu.: 8599.9  
##  Max.   :12102.0   Max.   :11720.0   Max.   :11258.7   Max.   :11497.7  
##       EOCT              ENOV              EDEC            EYR        
##  Min.   :  198.8   Min.   :  226.7   Min.   :  259   Min.   :  3106  
##  1st Qu.:  746.3   1st Qu.:  781.8   1st Qu.: 1048   1st Qu.:  9282  
##  Median : 2778.3   Median : 2938.2   Median : 3235   Median : 28368  
##  Mean   : 5174.8   Mean   : 5104.6   Mean   : 5131   Mean   : 52832  
##  3rd Qu.: 9417.3   3rd Qu.: 9997.2   3rd Qu.: 9748   3rd Qu.:106448  
##  Max.   :16635.3   Max.   :16069.0   Max.   :14530   Max.   :151065  
##     deficit      
##  Min.   :     6  
##  1st Qu.: 29505  
##  Median :124068  
##  Mean   :166675  
##  3rd Qu.:310264  
##  Max.   :418233
str(us_china_bymonth)
## tibble [37 × 29] (S3: tbl_df/tbl/data.frame)
##  $ year   : chr [1:37] "1985" "1986" "1987" "1988" ...
##  $ CTYNAME: chr [1:37] "China" "China" "China" "China" ...
##  $ IJAN   : num [1:37] 293 460 521 653 789 ...
##  $ IFEB   : num [1:37] 281 377 565 651 798 ...
##  $ IMAR   : num [1:37] 293 402 482 510 667 ...
##  $ IAPR   : num [1:37] 283 265 468 552 728 ...
##  $ IMAY   : num [1:37] 295 319 515 615 938 ...
##  $ IJUN   : num [1:37] 349 376 536 721 1022 ...
##  $ IJUL   : num [1:37] 344 450 560 762 1163 ...
##  $ IAUG   : num [1:37] 312 435 598 804 1280 ...
##  $ ISEP   : num [1:37] 392 413 550 793 1179 ...
##  $ IOCT   : num [1:37] 386 398 568 834 1340 ...
##  $ INOV   : num [1:37] 328 486 490 799 1134 ...
##  $ IDEC   : num [1:37] 306 391 440 818 952 ...
##  $ IYR    : num [1:37] 3862 4771 6294 8511 11990 ...
##  $ EJAN   : num [1:37] 319 300 213 290 439 ...
##  $ EFEB   : num [1:37] 223 331 213 360 465 ...
##  $ EMAR   : num [1:37] 240 290 208 408 565 ...
##  $ EAPR   : num [1:37] 266 319 440 446 415 ...
##  $ EMAY   : num [1:37] 329 257 229 314 482 ...
##  $ EJUN   : num [1:37] 281 275 262 503 363 ...
##  $ EJUL   : num [1:37] 383 199 227 484 638 ...
##  $ EAUG   : num [1:37] 321 236 278 424 688 ...
##  $ ESEP   : num [1:37] 339 216 304 396 428 ...
##  $ EOCT   : num [1:37] 377 199 377 413 542 ...
##  $ ENOV   : num [1:37] 316 227 350 449 305 ...
##  $ EDEC   : num [1:37] 462 259 396 534 424 ...
##  $ EYR    : num [1:37] 3856 3106 3497 5022 5755 ...
##  $ deficit: num [1:37] 6 1665 2796 3489 6234 ...
plot_missing(us_china_bymonth)

summary(us_mex_bymonth)
##      year             CTYNAME               IJAN            IFEB      
##  Length:37          Length:37          Min.   : 1156   Min.   : 1474  
##  Class :character   Class :character   1st Qu.: 3496   1st Qu.: 3614  
##  Mode  :character   Mode  :character   Median :10830   Median :10958  
##                                        Mean   :12334   Mean   :12498  
##                                        3rd Qu.:21504   3rd Qu.:22070  
##                                        Max.   :29041   Max.   :29037  
##       IMAR            IAPR            IMAY            IJUN      
##  Min.   : 1488   Min.   : 1377   Min.   : 1328   Min.   : 1238  
##  1st Qu.: 4207   1st Qu.: 3828   1st Qu.: 4033   1st Qu.: 4194  
##  Median :12045   Median :11471   Median :11928   Median :11944  
##  Mean   :14087   Mean   :13138   Mean   :13574   Mean   :13960  
##  3rd Qu.:23270   3rd Qu.:21360   3rd Qu.:22970   3rd Qu.:22928  
##  Max.   :33399   Max.   :32177   Max.   :31919   Max.   :33024  
##       IJUL            IAUG            ISEP            IOCT      
##  Min.   : 1653   Min.   : 1250   Min.   : 1381   Min.   : 1311  
##  1st Qu.: 3614   1st Qu.: 4355   1st Qu.: 4376   1st Qu.: 4581  
##  Median :11293   Median :12306   Median :12344   Median :12966  
##  Mean   :13352   Mean   :14190   Mean   :13914   Mean   :15042  
##  3rd Qu.:22526   3rd Qu.:23764   3rd Qu.:22304   3rd Qu.:24818  
##  Max.   :31908   Max.   :32088   Max.   :32048   Max.   :34358  
##       INOV            IDEC            IYR              EJAN      
##  Min.   : 1525   Min.   : 1382   Min.   : 17302   Min.   : 1017  
##  1st Qu.: 4930   1st Qu.: 4265   1st Qu.: 49494   1st Qu.: 3799  
##  Median :11940   Median :11417   Median :138060   Median : 8084  
##  Mean   :14182   Mean   :13143   Mean   :163414   Mean   : 9722  
##  3rd Qu.:23723   3rd Qu.:21352   3rd Qu.:277594   3rd Qu.:17011  
##  Max.   :34622   Max.   :33241   Max.   :384706   Max.   :21986  
##       EFEB            EMAR            EAPR            EMAY        
##  Min.   : 1031   Min.   : 1029   Min.   : 1101   Min.   :  863.3  
##  1st Qu.: 3672   1st Qu.: 3921   1st Qu.: 3614   1st Qu.: 3781.2  
##  Median : 8464   Median : 9641   Median : 9044   Median : 9143.8  
##  Mean   : 9483   Mean   :10442   Mean   : 9996   Mean   :10157.0  
##  3rd Qu.:16936   3rd Qu.:18093   3rd Qu.:16033   3rd Qu.:16811.8  
##  Max.   :21046   Max.   :23509   Max.   :22558   Max.   :23042.6  
##       EJUN            EJUL              EAUG            ESEP        
##  Min.   : 1061   Min.   :  820.3   Min.   : 1010   Min.   :  964.9  
##  1st Qu.: 3704   1st Qu.: 3522.6   1st Qu.: 4187   1st Qu.: 4062.3  
##  Median : 9172   Median : 8744.4   Median : 9494   Median : 9616.6  
##  Mean   :10349   Mean   :10301.4   Mean   :10666   Mean   :10388.4  
##  3rd Qu.:16793   3rd Qu.:17539.9   3rd Qu.:17764   3rd Qu.:17457.4  
##  Max.   :24134   Max.   :23661.0   Max.   :24181   Max.   :22784.1  
##       EOCT            ENOV              EDEC              EYR        
##  Min.   : 1087   Min.   :  945.8   Min.   :  945.2   Min.   : 12392  
##  1st Qu.: 4312   1st Qu.: 3967.8   1st Qu.: 3834.7   1st Qu.: 46292  
##  Median :10076   Median : 9927.1   Median : 8522.8   Median :110731  
##  Mean   :11397   Mean   :10750.4   Mean   : 9983.8   Mean   :123636  
##  3rd Qu.:20209   3rd Qu.:18764.0   3rd Qu.:16375.4   3rd Qu.:211481  
##  Max.   :24753   Max.   :24089.2   Max.   :23741.1   Max.   :276459  
##     deficit      
##  Min.   : -5381  
##  1st Qu.:  5688  
##  Median : 40648  
##  Mean   : 39779  
##  3rd Qu.: 64531  
##  Max.   :113731
str(us_mex_bymonth)
## tibble [37 × 29] (S3: tbl_df/tbl/data.frame)
##  $ year   : chr [1:37] "1985" "1986" "1987" "1988" ...
##  $ CTYNAME: chr [1:37] "Mexico" "Mexico" "Mexico" "Mexico" ...
##  $ IJAN   : num [1:37] 1303 1501 1156 1742 2017 ...
##  $ IFEB   : num [1:37] 1502 1474 1827 1961 2094 ...
##  $ IMAR   : num [1:37] 1698 1488 1713 2021 2290 ...
##  $ IAPR   : num [1:37] 1937 1377 1602 1796 2361 ...
##  $ IMAY   : num [1:37] 1328 1707 1764 1953 2530 ...
##  $ IJUN   : num [1:37] 1720 1238 1838 2118 2244 ...
##  $ IJUL   : num [1:37] 1708 1667 1653 1688 2173 ...
##  $ IAUG   : num [1:37] 1461 1250 1631 2014 2361 ...
##  $ ISEP   : num [1:37] 1479 1381 1724 1944 2211 ...
##  $ IOCT   : num [1:37] 1563 1311 1871 1998 2464 ...
##  $ INOV   : num [1:37] 1647 1525 1783 2057 2359 ...
##  $ IDEC   : num [1:37] 1786 1382 1707 1967 2058 ...
##  $ IYR    : num [1:37] 19132 17302 20271 23260 27162 ...
##  $ EJAN   : num [1:37] 1135 1023 1017 1286 1901 ...
##  $ EFEB   : num [1:37] 1117 1065 1031 1383 2029 ...
##  $ EMAR   : num [1:37] 1261 1029 1277 1668 2181 ...
##  $ EAPR   : num [1:37] 1237 1101 1121 1540 2044 ...
##  $ EMAY   : num [1:37] 863 1121 1192 1852 2097 ...
##  $ EJUN   : num [1:37] 1377 1061 1244 1594 2151 ...
##  $ EJUL   : num [1:37] 820 1039 1226 1621 2061 ...
##  $ EAUG   : num [1:37] 1406 1010 1193 1828 2148 ...
##  $ ESEP   : num [1:37] 1016 965 1328 1936 1956 ...
##  $ EOCT   : num [1:37] 1171 1087 1258 2047 2352 ...
##  $ ENOV   : num [1:37] 1214 946 1415 1954 2004 ...
##  $ EDEC   : num [1:37] 1017 945 1282 1918 2057 ...
##  $ EYR    : num [1:37] 13635 12392 14582 20629 24982 ...
##  $ deficit: num [1:37] 5497 4910 5688 2631 2180 ...
plot_missing(us_mex_bymonth)

Visualization and Explotary Analysis

U.S. Import & Export to China

options(scipen = 999) 

ggplot() + 
  geom_line(data = us_china_bymonth, aes(x = year, y = deficit, group=1), color = "red")+
  geom_line(data = us_china_bymonth, aes(x = year, y = IYR, group=1), color = "green")+geom_line(data = us_china_bymonth, aes(x = year, y = EYR, group=1), color = "blue")+coord_flip()+ggtitle('U.S. Import & Export & Deficit to China in Millions US Dollars')+ylab('Million US Dollars')+labs(caption ="U.S. import from China - Blue
U.S. export to China -Green
trade deficit between U.S. and China - Red
")

The Above graph explains that U.S. import from China overwhelms U.S exports to China. Both U.S. import and export to China drops during the trade war, especially import from China drops at significant rate from year 2018 to 2020. The U.S. trade deficit grows steadily until the trade section 301 activates since trump administration in 2018. The U.S.trade deficit drops until year 2020. However, it jumped back in year 2021 to the level of 2016. It means the trade section 301 works at the beginning of the time when it was launched, but due to the demand of import from China is strong, the import from China grows back again. Therefore, The trade section 301 may not effective in the long term, and China benefits from the trade between U.S. and China.

U.S. & China Trading Categories

longer_export<-us_export %>%
  pivot_longer(food_beverage:residual, names_to='category',values_to = 'value')

head(longer_export)
## # A tibble: 6 × 4
##   period            total category        value
##   <chr>             <dbl> <chr>           <dbl>
## 1 Jan. - Dec. (R) 1755233 food_beverage  153441
## 2 Jan. - Dec. (R) 1755233 industrial_sup 668282
## 3 Jan. - Dec. (R) 1755233 capital_goods  515444
## 4 Jan. - Dec. (R) 1755233 vehicles       140205
## 5 Jan. - Dec. (R) 1755233 consumer_goods 231437
## 6 Jan. - Dec. (R) 1755233 others          67191
ggplot(longer_export, aes(x=reorder(category,-value),
                          y=value,fill=category))+geom_bar(stat='identity')+theme_minimal()+ coord_flip()+ggtitle('U.S. Export to China in 2021')+ylab('U.S. Dollars in Million')+xlab('U.S. Export Categories')

# convert data to a long format

longer_import<-us_import %>%
  pivot_longer(food_beverage:residual, names_to='category',values_to = 'value')

head(longer_import)
## # A tibble: 6 × 4
##   period            total category        value
##   <chr>             <dbl> <chr>           <dbl>
## 1 Jan. - Dec. (R) 2990286 food_beverage  160588
## 2 Jan. - Dec. (R) 2990286 industrial_sup 723358
## 3 Jan. - Dec. (R) 2990286 capital_goods  813005
## 4 Jan. - Dec. (R) 2990286 vehicles       354856
## 5 Jan. - Dec. (R) 2990286 consumer_goods 768322
## 6 Jan. - Dec. (R) 2990286 others         121285
ggplot(longer_import, aes(x=reorder(category,-value),
                          y=value,fill=category))+geom_bar(stat='identity')+theme_minimal()+ coord_flip()+ggtitle('U.S. Import from China in 2021')+ylab('U.S. Dollars in Million')+xlab('U.S. Import Categories')

Based on the U.S. import and export data, the two graphs show that U.S. exports industrial supplies and capital goods the most, and followed by consumer goods and food beverage. Vehicles import listed the least in the big categories. In terms of import from China, U.S. import the capital goods and consumer goods the most, and followed by industrial supply and vehicles. Food and beverage listed the least among the big categories. Both China and U.S. relies on capital goods and industrial supplies each other which are the overlapped hot trading categories.

USD & CNY Exchange Rate

ggplot() + 
  geom_line(data = exchange_rate, aes(x = date, y = USDtoCNY, group=1), color = "red")+
  geom_line(data = exchange_rate, aes(x = date, y = CNYtoUSD, group=1), color = "green")+ggtitle('USD & CNY Exchange Rate')+xlab('Year')+ylab('Exchange Rate')+labs(caption ="USDCNY Exchange Rate - Red
CNYUSD Exchange Rate -Green
")

The exchange rate plays a huge role in trading across the country. One of the competitive key factors are the price. If the exchange rate is very high it means the price of the currency is relative low. China has been keeping the exchange rate within a low range since 1994. The high exchange rate and cheap price of the goods from China in terms of U.S. dollars, contributed and made China became the world manufacture house. it is not only cheap price of the goods and service, but also the cheap labor in U.S. dollars attract the U.S. consumers and investors. As the result, China benefits from trade with U.S.

U.S. Import & Export to Mexico

ggplot() + 
  geom_line(data = us_mex_bymonth, aes(x = year, y = deficit, group=1), color = "red")+
  geom_line(data = us_mex_bymonth, aes(x = year, y = IYR, group=1), color = "green")+geom_line(data = us_mex_bymonth, aes(x = year, y = EYR, group=1), color = "blue")+coord_flip()+ggtitle('U.S. Import & Export & Deficit to Mexico in Millions US Dollars')+ylab('Million US Dollars')+labs(caption ="U.S. import from Mexico - Blue
U.S. export to Mexico -Green
trade deficit between U.S. and Mexico - Red
")

The plot shows that the Mexico doesn’t receive the indirect benefit from the trade with U.S. as an alternative of the China. Even though the Trump administration activated the section 301 to China in July 2018, U.S. didn’t import additionally from Mexico. Oppositely, the import from Mexico has been decreased from the year of 2019 to 2020. It may be the shock from spreading of COIVD-19 virus. It seems the trading has been discourage in the year of 2019 to 2020, and jumped back in the year of 2021. In a certain time, from year 1991 to the year 1994, U.S. had trade surplus from trading with Mexico. However, the deficit increases steadily with a low pace.

Conclusion

In Conclusion, even though the Trump administration’s section 301 triggered the trade war, it was worked at the time it was activated, however the influence has been getting fade, and may not be effective in the long term of the trading with China. China is benefiting from the trade since the year 1985. Most of the items from China are capital goods, consumer goods and industrial supplies. Also, Mexico has not received the indirect benefit as an alternative of China. It probably the shock of the COVID-19 comes right after the activation of section 301 or U.S. consumers are not sensitively react the additional import tax from section 301.