API: comtradr

Access detailed global trade data through the Comtrad API.

Table of Contents


By using SKEMA Quantum Studio framework (Warin 2019), this course will teach you how to use the comtradr package.

Database description

UN Comtrade Database gives free access to detailed global trade data. UN Comtrade is a repository of official international trade statistics and relevant analytical tables. The UN Comtrade Database features inter-country trade data dating back to the early 1990’s.

UN Comtrade : https://comtrade.un.org/

Functions

This package gives access to all indicators provided by the UN Comtrade database. The functions listed below allow you to search and download specific data from the UN Comtrade database.

Each of these functions are detailed in this course and some examples are provided.

The function ct_search() takes as an input any string of character and will provide the list of all trades for the choosen parameters.

Lets say we want to get data on all imports into the United States from Germany, France, Japan, and Mexico, for all years.


#Loading the Comtrad package
library(comtradr)

# Search data on all imports into the United States from Germany, France, Japan, and Mexico, for all years:
q <- ct_search(reporters = "USA", 
               partners = c("Germany", "France", "Japan", "Mexico"), 
               trade_direction = "imports")

# Display the result
str(q)

'data.frame':   112 obs. of  35 variables:
 $ classification        : chr  "H5" "H5" "H5" "H5" ...
 $ year                  : int  2017 2017 2017 2017 2018 2018 2018 2018 2012 2012 ...
 $ period                : int  2017 2017 2017 2017 2018 2018 2018 2018 2012 2012 ...
 $ period_desc           : chr  "2017" "2017" "2017" "2017" ...
 $ aggregate_level       : int  0 0 0 0 0 0 0 0 0 0 ...
 $ is_leaf_code          : int  0 0 0 0 0 0 0 0 0 0 ...
 $ trade_flow_code       : int  1 1 1 1 1 1 1 1 1 1 ...
 $ trade_flow            : chr  "Import" "Import" "Import" "Import" ...
 $ reporter_code         : int  842 842 842 842 842 842 842 842 842 842 ...
 $ reporter              : chr  "USA" "USA" "USA" "USA" ...
 $ reporter_iso          : chr  "USA" "USA" "USA" "USA" ...
 $ partner_code          : int  251 276 392 484 251 276 392 484 251 276 ...
 $ partner               : chr  "France" "Germany" "Japan" "Mexico" ...
 $ partner_iso           : chr  "FRA" "DEU" "JPN" "MEX" ...
 $ second_partner_code   : logi  NA NA NA NA NA NA ...
 $ second_partner        : chr  NA NA NA NA ...
 $ second_partner_iso    : chr  NA NA NA NA ...
 $ customs_proc_code     : chr  NA NA NA NA ...
 $ customs               : chr  NA NA NA NA ...
 $ mode_of_transport_code: chr  NA NA NA NA ...
 $ mode_of_transport     : chr  NA NA NA NA ...
 $ commodity_code        : chr  "TOTAL" "TOTAL" "TOTAL" "TOTAL" ...
 $ commodity             : chr  "All Commodities" "All Commodities" "All Commodities" "All Commodities" ...
 $ qty_unit_code         : int  1 1 1 1 1 1 1 1 1 1 ...
 $ qty_unit              : chr  "No Quantity" "No Quantity" "No Quantity" "No Quantity" ...
 $ alt_qty_unit_code     : logi  NA NA NA NA NA NA ...
 $ alt_qty_unit          : chr  NA NA NA NA ...
 $ qty                   : int  0 0 0 0 0 0 0 0 NA NA ...
 $ alt_qty               : logi  NA NA NA NA NA NA ...
 $ netweight_kg          : int  0 0 0 0 0 0 0 0 NA NA ...
 $ gross_weight_kg       : logi  NA NA NA NA NA NA ...
 $ trade_value_usd       : num  5.00e+10 1.20e+11 1.40e+11 3.16e+11 5.36e+10 ...
 $ cif_trade_value_usd   : logi  NA NA NA NA NA NA ...
 $ fob_trade_value_usd   : logi  NA NA NA NA NA NA ...
 $ flag                  : int  4 4 4 4 4 4 4 4 0 0 ...
 - attr(*, "url")= chr "https://comtrade.un.org/api/get?max=50000&type=C&freq=A&px=HS&ps=all&r=842&p=276%2C251%2C392%2C484&rg=1&cc=TOTA"| __truncated__
 - attr(*, "time_stamp")= POSIXct, format: "2020-01-29 15:31:06"
 - attr(*, "req_duration")= num 0.937

Here are a few more examples to show the different parameter options:

For example, if we want to get data on all imports into the United States from Germany, France, Japan, and Mexico, between 2010 and 2014:


# Search all the imports to USA from Germany, France, Japan, and Mexico, between 2010 and 2014:
q <- ct_search(reporters = "USA", 
               partners = c("Germany", "France", "Japan", "Mexico"), 
               trade_direction = "imports", 
               start_date = 2010, 
               end_date = 2014)

By default, the return data is in yearly amounts. We can pass “monthly” to arg freq to return data in monthly amounts, however the API limits each “monthly” query to a single year.


# Get all monthly data for a single year (API max of 12 months per call).
q <- ct_search(reporters = "USA", 
               partners = c("Germany", "France", "Japan", "Mexico"), 
               trade_direction = "imports", 
               start_date = 2012, 
               end_date = 2012, 
               freq = "monthly")

# Get monthly data for a specific span of months (API max of five months per call).
q <- ct_search(reporters = "USA", 
               partners = c("Germany", "France", "Japan", "Mexico"), 
               trade_direction = "imports", 
               start_date = "2012-03", 
               end_date = "2012-07", 
               freq = "monthly")

ct_country_lookup()

Countries passed to parameters reporters and partners must be spelled as they appear in the Comtrade country reference table. Function ct_country_lookup allows us to query the country reference table.


# Search the names that have to be use for Korea and Bolivia:
ct_country_lookup("korea", "reporter")

[1] "Dem. People's Rep. of Korea" "Rep. of Korea"              

#> [1] "Dem. People's Rep. of Korea" "Rep. of Korea"
ct_country_lookup("bolivia", "partner")

[1] "Bolivia (Plurinational State of)"

#> [1] "Bolivia (Plurinational State of)"

# Then using them for a ct_search
q <- ct_search(reporters = "Rep. of Korea", 
               partners = "Bolivia (Plurinational State of)", 
               trade_direction = "all")

The function ct_country_lookup is able to take multiple search terms as input.


# Search multiple terms as input
ct_country_lookup(c("Belgium", "vietnam", "brazil"), "reporter")

[1] "Belgium"                  "Belgium-Luxembourg"      
[3] "Brazil"                   "Fmr Dem. Rep. of Vietnam"
[5] "Fmr Rep. of Vietnam"     

ct_commodity_lookup()

Search trade related to specific commodities (for example: tomatoes). We can query the Comtrade commodity reference table to see all of the different commodity descriptions available for tomatoes.


# Gives all the codes related to "tomato"
ct_commodity_lookup("tomato")

$tomato
[1] "0702 - Tomatoes; fresh or chilled"                                                                                                         
[2] "070200 - Vegetables; tomatoes, fresh or chilled"                                                                                           
[3] "2002 - Tomatoes; prepared or preserved otherwise than by vinegar or acetic acid"                                                           
[4] "200210 - Vegetable preparations; tomatoes, whole or in pieces, prepared or preserved otherwise than by vinegar or acetic acid"             
[5] "200290 - Vegetable preparations; tomatoes, (other than whole or in pieces), prepared or preserved otherwise than by vinegar or acetic acid"
[6] "200950 - Juice; tomato, unfermented, not containing added spirit, whether or not containing added sugar or other sweetening matter"        
[7] "210320 - Sauces; tomato ketchup and other tomato sauces"                                                                                   

If we want to search for shipment data on all of the commodity descriptions listed, then we can simply adjust the parameters for ct_commodity_lookup so that it will return only the codes, which can then be passed along to ct_search.


# Search for a specific commodity (tomatoes)
tomato_codes <- ct_commodity_lookup("tomato", 
                                    return_code = TRUE, 
                                    return_char = TRUE)

q <- ct_search(reporters = "USA", 
               partners = c("Germany", "France", "Mexico"), 
               trade_direction = "all", 
               commod_codes = tomato_codes)

# Display the results
str(q)

'data.frame':   926 obs. of  35 variables:
 $ classification        : chr  "H5" "H5" "H5" "H5" ...
 $ year                  : int  2017 2017 2017 2018 2018 2018 2017 2017 2017 2018 ...
 $ period                : int  2017 2017 2017 2018 2018 2018 2017 2017 2017 2018 ...
 $ period_desc           : chr  "2017" "2017" "2017" "2018" ...
 $ aggregate_level       : int  4 4 4 4 4 4 6 6 6 6 ...
 $ is_leaf_code          : int  0 0 0 0 0 0 1 1 1 1 ...
 $ trade_flow_code       : int  1 2 3 1 2 3 1 2 3 1 ...
 $ trade_flow            : chr  "Import" "Export" "Re-Export" "Import" ...
 $ reporter_code         : int  842 842 842 842 842 842 842 842 842 842 ...
 $ reporter              : chr  "USA" "USA" "USA" "USA" ...
 $ reporter_iso          : chr  "USA" "USA" "USA" "USA" ...
 $ partner_code          : int  484 484 484 484 484 484 484 484 484 484 ...
 $ partner               : chr  "Mexico" "Mexico" "Mexico" "Mexico" ...
 $ partner_iso           : chr  "MEX" "MEX" "MEX" "MEX" ...
 $ second_partner_code   : logi  NA NA NA NA NA NA ...
 $ second_partner        : chr  NA NA NA NA ...
 $ second_partner_iso    : chr  NA NA NA NA ...
 $ customs_proc_code     : chr  NA NA NA NA ...
 $ customs               : chr  NA NA NA NA ...
 $ mode_of_transport_code: chr  NA NA NA NA ...
 $ mode_of_transport     : chr  NA NA NA NA ...
 $ commodity_code        : chr  "0702" "0702" "0702" "0702" ...
 $ commodity             : chr  "Tomatoes; fresh or chilled" "Tomatoes; fresh or chilled" "Tomatoes; fresh or chilled" "Tomatoes; fresh or chilled" ...
 $ qty_unit_code         : int  8 8 8 8 8 8 8 8 8 8 ...
 $ qty_unit              : chr  "Weight in kilograms" "Weight in kilograms" "Weight in kilograms" "Weight in kilograms" ...
 $ alt_qty_unit_code     : logi  NA NA NA NA NA NA ...
 $ alt_qty_unit          : chr  NA NA NA NA ...
 $ qty                   : int  1612336687 6533268 2050727 1691901630 3871738 1646252 1612336687 6533268 2050727 1691901630 ...
 $ alt_qty               : logi  NA NA NA NA NA NA ...
 $ netweight_kg          : int  1612336687 6533268 2050727 1691901630 3871738 1646252 1612336687 6533268 2050727 1691901630 ...
 $ gross_weight_kg       : logi  NA NA NA NA NA NA ...
 $ trade_value_usd       : num  1.93e+09 6.13e+06 1.83e+06 2.16e+09 3.79e+06 ...
 $ cif_trade_value_usd   : logi  NA NA NA NA NA NA ...
 $ fob_trade_value_usd   : logi  NA NA NA NA NA NA ...
 $ flag                  : int  0 0 0 0 0 0 0 0 0 0 ...
 - attr(*, "url")= chr "https://comtrade.un.org/api/get?max=50000&type=C&freq=A&px=HS&ps=all&r=842&p=276%2C251%2C484&rg=all&cc=0702%2C0"| __truncated__
 - attr(*, "time_stamp")= POSIXct, format: "2020-01-29 15:31:18"
 - attr(*, "req_duration")= num 20.4

On the other hand, if we wanted to exclude juices and sauces from our search, we can pass a vector of the relevant codes to the API call.


# Search for specific commodities (each code is a comodity)
q <- ct_search(reporters = "USA", 
               partners = c("Germany", "France", "Mexico"), 
               trade_direction = "all", 
               commod_codes = c("0702", "070200", "2002", "200210", "200290"))

# Display the results
str(q)

'data.frame':   653 obs. of  35 variables:
 $ classification        : chr  "H5" "H5" "H5" "H5" ...
 $ year                  : int  2017 2017 2017 2018 2018 2018 2017 2017 2017 2018 ...
 $ period                : int  2017 2017 2017 2018 2018 2018 2017 2017 2017 2018 ...
 $ period_desc           : chr  "2017" "2017" "2017" "2018" ...
 $ aggregate_level       : int  4 4 4 4 4 4 6 6 6 6 ...
 $ is_leaf_code          : int  0 0 0 0 0 0 1 1 1 1 ...
 $ trade_flow_code       : int  1 2 3 1 2 3 1 2 3 1 ...
 $ trade_flow            : chr  "Import" "Export" "Re-Export" "Import" ...
 $ reporter_code         : int  842 842 842 842 842 842 842 842 842 842 ...
 $ reporter              : chr  "USA" "USA" "USA" "USA" ...
 $ reporter_iso          : chr  "USA" "USA" "USA" "USA" ...
 $ partner_code          : int  484 484 484 484 484 484 484 484 484 484 ...
 $ partner               : chr  "Mexico" "Mexico" "Mexico" "Mexico" ...
 $ partner_iso           : chr  "MEX" "MEX" "MEX" "MEX" ...
 $ second_partner_code   : logi  NA NA NA NA NA NA ...
 $ second_partner        : chr  NA NA NA NA ...
 $ second_partner_iso    : chr  NA NA NA NA ...
 $ customs_proc_code     : chr  NA NA NA NA ...
 $ customs               : chr  NA NA NA NA ...
 $ mode_of_transport_code: chr  NA NA NA NA ...
 $ mode_of_transport     : chr  NA NA NA NA ...
 $ commodity_code        : chr  "0702" "0702" "0702" "0702" ...
 $ commodity             : chr  "Tomatoes; fresh or chilled" "Tomatoes; fresh or chilled" "Tomatoes; fresh or chilled" "Tomatoes; fresh or chilled" ...
 $ qty_unit_code         : int  8 8 8 8 8 8 8 8 8 8 ...
 $ qty_unit              : chr  "Weight in kilograms" "Weight in kilograms" "Weight in kilograms" "Weight in kilograms" ...
 $ alt_qty_unit_code     : logi  NA NA NA NA NA NA ...
 $ alt_qty_unit          : chr  NA NA NA NA ...
 $ qty                   : int  1612336687 6533268 2050727 1691901630 3871738 1646252 1612336687 6533268 2050727 1691901630 ...
 $ alt_qty               : logi  NA NA NA NA NA NA ...
 $ netweight_kg          : int  1612336687 6533268 2050727 1691901630 3871738 1646252 1612336687 6533268 2050727 1691901630 ...
 $ gross_weight_kg       : logi  NA NA NA NA NA NA ...
 $ trade_value_usd       : num  1.93e+09 6.13e+06 1.83e+06 2.16e+09 3.79e+06 ...
 $ cif_trade_value_usd   : logi  NA NA NA NA NA NA ...
 $ fob_trade_value_usd   : logi  NA NA NA NA NA NA ...
 $ flag                  : int  0 0 0 0 0 0 0 0 0 0 ...
 - attr(*, "url")= chr "https://comtrade.un.org/api/get?max=50000&type=C&freq=A&px=HS&ps=all&r=842&p=276%2C251%2C484&rg=all&cc=0702%2C0"| __truncated__
 - attr(*, "time_stamp")= POSIXct, format: "2020-01-29 15:31:38"
 - attr(*, "req_duration")= num 19.4

The function ct_commodity_lookup is able to take multiple search terms as input.


# Search multiple terms as input
ct_commodity_lookup(c("tomato", "trout"), return_char = TRUE)

 [1] "0702 - Tomatoes; fresh or chilled"                                                                                                                                                                                                                                  
 [2] "070200 - Vegetables; tomatoes, fresh or chilled"                                                                                                                                                                                                                    
 [3] "2002 - Tomatoes; prepared or preserved otherwise than by vinegar or acetic acid"                                                                                                                                                                                    
 [4] "200210 - Vegetable preparations; tomatoes, whole or in pieces, prepared or preserved otherwise than by vinegar or acetic acid"                                                                                                                                      
 [5] "200290 - Vegetable preparations; tomatoes, (other than whole or in pieces), prepared or preserved otherwise than by vinegar or acetic acid"                                                                                                                         
 [6] "200950 - Juice; tomato, unfermented, not containing added spirit, whether or not containing added sugar or other sweetening matter"                                                                                                                                 
 [7] "210320 - Sauces; tomato ketchup and other tomato sauces"                                                                                                                                                                                                            
 [8] "030191 - Fish; live, trout (salmo trutta, salmo gairdneri, salmo clarki, salmo aguabonita, salmo gilae)"                                                                                                                                                            
 [9] "030211 - Fish; trout (salmo trutta, salmo gairdneri, salmo clarki, salmo aguabonita, salmo gilae), fresh or chilled (excluding fillets, livers, roes and other fish meat of heading no. 0304)"                                                                      
[10] "030314 - Fish; frozen, trout (Salmo trutta, Oncorhynchus mykiss, Oncorhynchus clarki, Oncorhynchus aguabonita, Oncorhynchus gilae, Oncorhynchus apache and Oncorhynchus chrysogaster), excluding fillets, meat of 0304, and edible fish offal of 0303.91 to 0303.99"
[11] "030321 - Fish; trout (salmo trutta, salmo gairdneri, salmo clarki, salmo aguabonita, salmo gilae), frozen (excluding fillets, livers, roes and other fish meat of heading no. 0304)"                                                                                
[12] "030442 - Fish fillets; fresh or chilled, trout (Salmo trutta, Oncorhynchus mykiss, Oncorhynchus clarki, Oncorhynchus aguabonita, Oncorhynchus gilae, Oncorhynchus apache and Oncorhynchus chrysogaster)"                                                            
[13] "030482 - Fish fillets; frozen, trout (Salmo trutta, Oncorhynchus mykiss, Oncorhynchus clarki, Oncorhynchus aguabonita, Oncorhynchus gilae, Oncorhynchus apache and Oncorhynchus chrysogaster)"                                                                      
[14] "030543 - Fish; smoked, whether or not cooked before or during smoking, trout (Salmo trutta, Oncorhynchus mykiss/clarki/aguabonita/gilae/apache/chrysogaster), includes fillets, but excludes edible fish offal"                                                     

ct_commodity_lookup can return a vector (as seen above) or a named list, using parameter return_char


# Search multiple terms as input
ct_commodity_lookup(c("tomato", "trout"), return_char = FALSE)

$tomato
[1] "0702 - Tomatoes; fresh or chilled"                                                                                                         
[2] "070200 - Vegetables; tomatoes, fresh or chilled"                                                                                           
[3] "2002 - Tomatoes; prepared or preserved otherwise than by vinegar or acetic acid"                                                           
[4] "200210 - Vegetable preparations; tomatoes, whole or in pieces, prepared or preserved otherwise than by vinegar or acetic acid"             
[5] "200290 - Vegetable preparations; tomatoes, (other than whole or in pieces), prepared or preserved otherwise than by vinegar or acetic acid"
[6] "200950 - Juice; tomato, unfermented, not containing added spirit, whether or not containing added sugar or other sweetening matter"        
[7] "210320 - Sauces; tomato ketchup and other tomato sauces"                                                                                   

$trout
[1] "030191 - Fish; live, trout (salmo trutta, salmo gairdneri, salmo clarki, salmo aguabonita, salmo gilae)"                                                                                                                                                            
[2] "030211 - Fish; trout (salmo trutta, salmo gairdneri, salmo clarki, salmo aguabonita, salmo gilae), fresh or chilled (excluding fillets, livers, roes and other fish meat of heading no. 0304)"                                                                      
[3] "030314 - Fish; frozen, trout (Salmo trutta, Oncorhynchus mykiss, Oncorhynchus clarki, Oncorhynchus aguabonita, Oncorhynchus gilae, Oncorhynchus apache and Oncorhynchus chrysogaster), excluding fillets, meat of 0304, and edible fish offal of 0303.91 to 0303.99"
[4] "030321 - Fish; trout (salmo trutta, salmo gairdneri, salmo clarki, salmo aguabonita, salmo gilae), frozen (excluding fillets, livers, roes and other fish meat of heading no. 0304)"                                                                                
[5] "030442 - Fish fillets; fresh or chilled, trout (Salmo trutta, Oncorhynchus mykiss, Oncorhynchus clarki, Oncorhynchus aguabonita, Oncorhynchus gilae, Oncorhynchus apache and Oncorhynchus chrysogaster)"                                                            
[6] "030482 - Fish fillets; frozen, trout (Salmo trutta, Oncorhynchus mykiss, Oncorhynchus clarki, Oncorhynchus aguabonita, Oncorhynchus gilae, Oncorhynchus apache and Oncorhynchus chrysogaster)"                                                                      
[7] "030543 - Fish; smoked, whether or not cooked before or during smoking, trout (Salmo trutta, Oncorhynchus mykiss/clarki/aguabonita/gilae/apache/chrysogaster), includes fillets, but excludes edible fish offal"                                                     

For ct_commodity_lookup, if any of the input search terms return zero results and parameter verbose is set to TRUE, a warning will be printed to console (set verbose to FALSE to turn off this feature).


# Search multiple terms as input
ct_commodity_lookup(c("tomato", "sldfkjkfdsklsd"), verbose = TRUE)

$tomato
[1] "0702 - Tomatoes; fresh or chilled"                                                                                                         
[2] "070200 - Vegetables; tomatoes, fresh or chilled"                                                                                           
[3] "2002 - Tomatoes; prepared or preserved otherwise than by vinegar or acetic acid"                                                           
[4] "200210 - Vegetable preparations; tomatoes, whole or in pieces, prepared or preserved otherwise than by vinegar or acetic acid"             
[5] "200290 - Vegetable preparations; tomatoes, (other than whole or in pieces), prepared or preserved otherwise than by vinegar or acetic acid"
[6] "200950 - Juice; tomato, unfermented, not containing added spirit, whether or not containing added sugar or other sweetening matter"        
[7] "210320 - Sauces; tomato ketchup and other tomato sauces"                                                                                   

$sldfkjkfdsklsd
character(0)

tl;dr


#Loading the Comtrad package
library(comtradr)

# Search data on all imports into the United States from Germany, France, Japan, and Mexico, for all years:
q <- ct_search(reporters = "USA", 
               partners = c("Germany", "France", "Japan", "Mexico"), 
               trade_direction = "imports")

# Display the result
str(q)

# Search all the imports to USA from Germany, France, Japan, and Mexico, between 2010 and 2014:
q <- ct_search(reporters = "USA", 
               partners = c("Germany", "France", "Japan", "Mexico"), 
               trade_direction = "imports", 
               start_date = 2010, 
               end_date = 2014)

# Get all monthly data for a single year (API max of 12 months per call).
q <- ct_search(reporters = "USA", 
               partners = c("Germany", "France", "Japan", "Mexico"), 
               trade_direction = "imports", 
               start_date = 2012, 
               end_date = 2012, 
               freq = "monthly")

# Get monthly data for a specific span of months (API max of five months per call).
q <- ct_search(reporters = "USA", 
               partners = c("Germany", "France", "Japan", "Mexico"), 
               trade_direction = "imports", 
               start_date = "2012-03", 
               end_date = "2012-07", 
               freq = "monthly")

# Search the names that have to be use for Korea and Bolivia:
ct_country_lookup("korea", "reporter")

ct_country_lookup("bolivia", "partner")

# Then using them for a ct_search
q <- ct_search(reporters = "Rep. of Korea", 
               partners = "Bolivia (Plurinational State of)", 
               trade_direction = "all")

# Search multiple terms as input
ct_country_lookup(c("Belgium", "vietnam", "brazil"), "reporter")

# Gives all the codes related to "tomato"
ct_commodity_lookup("tomato")

# Search for a specific commodity (tomatoes)
tomato_codes <- ct_commodity_lookup("tomato", 
                                    return_code = TRUE, 
                                    return_char = TRUE)

q <- ct_search(reporters = "USA", 
               partners = c("Germany", "France", "Mexico"), 
               trade_direction = "all", 
               commod_codes = tomato_codes)

# Display the results
str(q)

# Search for specific commodities (each code is a comodity)
q <- ct_search(reporters = "USA", 
               partners = c("Germany", "France", "Mexico"), 
               trade_direction = "all", 
               commod_codes = c("0702", "070200", "2002", "200210", "200290"))

# Display the results
str(q)

# Search multiple terms as input
ct_commodity_lookup(c("tomato", "trout"), return_char = TRUE)

# Search multiple terms as input
ct_commodity_lookup(c("tomato", "trout"), return_char = FALSE)

# Search multiple terms as input
ct_commodity_lookup(c("tomato", "sldfkjkfdsklsd"), verbose = TRUE)

Code learned this week

Command Detail
ct_search() Search for UN Comtrade trades
ct_country_lookup() Find data related for each country
ct_comodity_lookup() Find data related for each comodity

References

This course uses the UN Comtrad package documentation


Warin, Thierry. 2019. “SKEMA Quantum Studio: A Technological Framework for Data Science in Higher Education.” https://doi.org/10.6084/m9.figshare.8204195.v2.

Citation

For attribution, please cite this work as

Warin (2020, Jan. 29). Virtual Campus: API: comtradr. Retrieved from https://virtualcampus.skemagloballab.io/posts/apicomtrad/

BibTeX citation

@misc{warin2020api:,
  author = {Warin, Thierry},
  title = {Virtual Campus: API: comtradr},
  url = {https://virtualcampus.skemagloballab.io/posts/apicomtrad/},
  year = {2020}
}