Description Usage Arguments Details Value See Also Examples
Download trade data from the Comtrade API, provided by the United Nations.
1 2 3 | getComtrade(region, partner, time = "now", freq = "A", type = "C",
classification = "HS", tradeflow = "all", cc = "TOTAL", fmt = "json",
maxrec = 100000)
|
region |
the reporting region/country |
partner |
the partner region |
time |
the time period as a string. Can be a year, i.e. "2013" or a month in a year, i.e. "201301", depending on whether freq is "A" or "M" |
freq |
frequency, can be either "A" for annual data or "M" for monthly data |
type |
type of trade flow. Currently only "C" for commodity. In the future maybe also "S" for Services. |
classification |
revision of the HS classification that is used. Default is "HS" which corresponds to "HS, as reported", but can also be "H0", "H1", ..., "ST" (SITC classification, as reported), "S1", ... or "BEC" (Broad Economic Categories). The homepage has more information on this. |
tradeflow |
the tradeflow, can be "1" for imports, "2" for exports or "all" for both (default) |
cc |
the classification code for the commodity, such as "0101" for live animals, according to the HS classification. Special codes are "TOTAL" for the total trade between reporter and partner, "ALL" for all commodities or "AG1" to "AG6" for detailed codes at specific level. |
fmt |
the format, either "csv" for a .CSV download or "json" for a JSON download. JSON also provides a validation list, which contains any errors and query information. |
maxrec |
the maximum number of records, default = 100000. |
Downloads the data and returns it in usable format, see See also
for the API-homepage
a list with a validation list (if fmt = "JSON" was specified) and a data.frame which contains the data
http://comtrade.un.org/data/doc/api/
1 | dta <- getComtrade(region = "40", partner = "688")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.