Contains functions for collecting trade data via the Comtrade bulk download API.
Install from GitHub with:
# install.packages("devtools")
devtools::install_github("lee269/iapdashboardadmin")
library(iapdashboardadmin)
# Acquire a number of individual countries annual trade data
get_countries_years(periods = c(2010:2018),
reporters = c(152, 156),
token = "your token here",
dest_folder = "~/downloads",
unzip = FALSE)
# Process all the downloaded files and extract only the food data
ffd_trade_data <- merge_ffd(folder = "~/downloads")
# Save for posterity
saveRDS(ffd_trade_data, "~/data/ffd_data.rds")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.