In order to simplify loading and working with the Comtrade data with no complications with the databases (relying only on the available RAM) we develop a structure of all data locally in the folders in the ~
(root) folder of the computer. Function build_ct_storage()
from the tradeAnalysis package. This function creates a folder ctData
in the Documents
folder (on Windows Machine) or in ~
folder on any other kind of machine.
Withing this folder there is also an R project created along with the folders for data structure and several R scripts:
update_local_CT_data.R
Script for updating locally downloaded CT data and downloading new data;
prepare_shinyApp_data.R
Script developed for preparing CT data for the Shiny app structure;
.CT-token
text file with the token for accessing to the Comtrade data (for more information about token see).
Order of running:
open empty R session;
install up to date version of tradeAnalysis
package from the git-hub running devtools::install_github("EBukin/tradeAnalysis-pack")
in the console;
load the tradeAnalysis
package running library(tradeAnalysis)
;
run command build_ct_storage()
;
go to your ~
folder (Documents) on Windows machine C:\Users\USER_NAME\Documents
;
find the folder ctData
and open the project, which is there;
(only if you are doingt this from the outside of FAO building) copy and paste your token (without the quotation marks) onto .CT-token
as text. How to access your token is explained on the “Loading COMTRADE data in R”;
open the script update_local_CT_data.R
and source it all or run line by line (may take up to several days it this is the first run);
open the script prepare_shinyApp_data.R
and source it all or run line by line;
Here you go!
Copyright © 2017 Eduard Bukin. All rights reserved.