Aaron’s blog

Loading NZ harmonised trade data

I’ve been working with “harmonised trade” exports & imports data for a project recently, making use of the huge collection of CSV files that Statistics New Zealand has published. All up there’s about 2GB of data in those files.

I’ve written some code to load selected fields from this data into R for analysis. I’ve only loaded up dates, commodities, countries, and dollar values, but the code can be easily modified to load other fields (eg volumes) if needed.

Also included is a quick demonstration of using the dataset, by creating these simple small-multiples charts of imports and export value by country over time, for the top 20 countries based on 2014 trade values (click for bigger):

exports-small-multiples

imports-small-multiples