Learn R Programming

comtradr (version 0.0.2)

ct_commodities_table: Extract commodity code look up table from UN Comtrade

Description

Returns a dataframe of commodities, commodity codes and parent codes, downloaded from UN Comtrade. For use with the UN Comtrade API, full API docs can be found at https://comtrade.un.org/data/doc/api/

Usage

ct_commodities_table(type = c("HS", "HS1992", "HS1996", "HS2002", "HS2007",
  "HS2012", "SITC", "SITCrev1", "SITCrev2", "SITCrev3", "SITCrev4", "BEC",
  "EB02"), baseurl = "https://comtrade.un.org/", path = "data/cache/")

Arguments

type

Trade data classification scheme to use, see "Details" for a list of the valid inputs.

baseurl

The base url of the UN Comtrade website.

path

The path url string that points to the correct directory.

Value

A dataframe of commodities, commodity codes and parent codes, downloaded from UN Comtrade.

Details

The default for param type is HS. Below is a list of all valid inputs with a very brief description for each, for more information on each of these types, see https://comtrade.un.org/data/doc/api/#DataAvailabilityRequests

  • HS: Harmonized System (HS), as reported

  • HS1992: HS 1992

  • HS1996: HS 1996

  • HS2002: HS 2002

  • HS2007: HS 2007

  • HS2012: HS 2012

  • SITC: Standard International Trade Classification (SITC), as reported

  • SITCrev1: SITC Revision 1

  • SITCrev2: SITC Revision 2

  • SITCrev3: SITC Revision 3

  • SITCrev4: SITC Revision 4

  • BEC: Broad Economic Categories

  • EB02: Extended Balance of Payments Services Classification

The default for param baseurl is "https://comtrade.un.org/", and should only be changed if the Comtrade website url changes.

The default for param path is "data/cache/", and should only be changed if the Comtrade website changes or if Comtrade changes the url path that points to the JSON commodity tables.

Examples

Run this code
# NOT RUN {
ct_commodities_table("HS")
ct_commodities_table("SITCrev2")
# }

Run the code above in your browser using DataLab