Site icon R-bloggers

NAFTA trade dashboard

[This article was first published on En El Margen - R-English, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Tradewatch is a dashboard, written in R using the flexdashboard framework. Visualizations are made possible thanks to highcharter and other packages.

The main purpose of the dashboard is to monitor trade, mostly from the Mexican perspective, of goods and commodities with countries that are in NAFTA.

In the age of fake news and policy-by-twitter, hopefully this tool will help guide more informed debate (and decisions) with respect to trade between these three countries.

Notes and methodology

The dashboard consists of basically three sections:

The names of HS Codes have been abbreviated manually, they can be found here, however the code is still in between parenthesis. Should you want to look it up further, I recommend the UN Comtrade website

Suggestions

This release is a first and fast dive into the data, so I would be happy to listen to improvements to the tool, including some new indicators I haven’t added. FYI, I tried to build the export matrixes at a 4-level granularity, but highcharts couldn’t handle it, any suggestions on how to do it would be welcome.

Dashboards

The newest I could build is from november 2016, which is the month all three countries have statistics ready.

Code

The code used to build the dashboard consists of two files: a functions.R file that contains some functions for downloading and cleaning the data and a db.Rmd file that builds the dashboard using the knitr/flexdashboard process in RStudio.

Both of these files can be found here and here.

FYI, I borrowed heavily from here and here.

To leave a comment for the author, please follow the link and comment on their blog: En El Margen - R-English.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.