Package: comtradr 1.1.0

Paul Bochtler

comtradr: Interface with the United Nations Comtrade API

Interface with and extract data from the United Nations 'Comtrade' API <https://comtradeplus.un.org/>. 'Comtrade' provides country level shipping data for a variety of commodities, these functions allow for easy API query and data returned as a tidy data frame.

Authors:Paul Bochtler [aut, cre, cph], Harriet Goers [aut], Chris Muir [aut], Alicia Schep [rev], Rafael Hellwig [rev], Ernest Guevarra [rev], Nicholas Potter [rev], Juergen Amann [ctb]

comtradr_1.1.0.tar.gz
comtradr_1.1.0.zip(r-4.7-any)comtradr_1.1.0.zip(r-4.6-any)comtradr_1.1.0.zip(r-4.5-any)
comtradr_1.1.0.tgz(r-4.6-any)comtradr_1.1.0.tgz(r-4.5-any)
comtradr_1.1.0.tar.gz(r-4.7-any)comtradr_1.1.0.tar.gz(r-4.6-any)
comtradr_1.1.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
comtradr/json (API)

# Install 'comtradr' in R:
install.packages('comtradr', repos = c('https://ropensci.r-universe.dev', 'https://cloud.r-project.org'))

Reviews:rOpenSci Software Review #613

Bug tracker:https://github.com/ropensci/comtradr/issues

Pkgdown/docs site:https://docs.ropensci.org

Datasets:

On CRAN:

Conda:

apicomtradepeer-reviewedsupply-chain

9.07 score 84 stars 130 scripts 781 downloads 1 mentions 16 exports 41 dependencies

Last updated from:56e547d376 (on main). Checks:10 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-develOK156
pkgdown docsOK168
source / vignettesOK258
linux-releaseOK145
macos-releaseOK103
macos-oldrelOK90
windows-develOK81
windows-releaseOK91
windows-oldrelOK87
wasm-releaseOK135

Exports:ct_commodity_db_typect_commodity_lookupct_country_lookupct_get_bulkct_get_datact_get_ref_tablect_get_remaining_hourly_queriesct_get_reset_timect_get_trade_matrixct_migrate_cachect_register_tokenct_searchct_update_databasesct_use_pretty_colsget_primary_comtrade_keyset_primary_comtrade_key

Dependencies:askpassbitbit64cachemclicliprcpp11crayoncurldplyrfastmapfsgenericsgluehmshttr2lifecyclelubridatemagrittrmemoiseopensslpillarpkgconfigprettyunitsprogresspurrrR6rappdirsreadrrlangstringistringrsystibbletidyselecttimechangetzdbutf8vctrsvroomwithr

The estimated trade matrix
What is the estimated trade matrix? | Authentication | A basic call | The World rows, and why they will ruin your totals | What is_reported actually means | Commodities | Values, dates and flows | Caveats worth carrying into your analysis | See also

Last update: 2026-09-19
Started: 2026-09-19

Transition from old comtradr
Transitioning from the old API to the new API 🔄 | The basics 📊 | The time parameter | Country Names 🌍 | Previously | Now | Searching for commodity codes 🚢📦 | Previously == Now | API search metadata 📑 | Package Data 📦 | "Polished" Column Headers 🎨

Last update: 2026-07-30
Started: 2023-12-22

comtradr
Data availability | Package information | Install and load comtradr | Authentication 🔐 | Storing the API key | Making API calls | API search metadata | More on the lookup functions | API rate limits | Package Data | Visualize | Handling large amounts of Parameters | commodity_code | flow_direction | reporter and partner | mode_of_transport, partner_2, and customs_code | Example Usage

Last update: 2025-07-31
Started: 2023-06-27

Caching requests from the UN Comtrade API
The basics of caching 💽 | Careful with outdated data! ⚠️

Last update: 2024-05-23
Started: 2024-02-04

Querying bulk files from the API
Why use bulk files? 📦📦📦 | Accounting for HS Code changes 🏗️👷 | Getting started with bulk files 🏃 | Formatting bulk files 📝

Last update: 2024-05-13
Started: 2024-05-13

Querying large amounts of data
The limits | The example - Imports of the EU | 1. What are the commodity codes? | 2. Which are the countries? | Getting the data | EU imports from all countries | Data cleaning | Caveat on trade "dependencies"

Last update: 2024-05-13
Started: 2023-12-22