Skip to content

comtradr

1.0.6Package record

Interface with the United Nations Comtrade API

0packages dependsuggested by 1
9.6Kdownloads / year
81.3%test coverage
13/13flavors OK

Overview

About

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.

Changes in 1.0.6

Minor improvements

  • Replaced the poorman dependency (scheduled for archival on CRAN) with dplyr. This does not add any new transitive dependencies, as all of dplyr's dependencies were already required through other imports.

Bug fixes

  • ct_get_bulk() now validates the frequency argument instead of failing with an obscure object 'date_range' not found error.
  • Invalid partner / partner_2 values now produce a readable error message that lists each invalid code once, instead of repeating the message for every code.
  • ct_migrate_cache() no longer fails with argument "message" is missing when reporting a failed copy.
Show all changes in 1.0.6Hide the rest of the changes in 1.0.6
  • Fixed HTTP 414 "URI Too Long" errors when querying long code lists, e.g. partner = "all_countries" (#103). The Comtrade API rejects URLs longer than about 2000 characters. ct_get_data() now detects this before performing the request, transparently splits the partner and/or reporter codes into multiple requests and combines the results into a single data.frame. With process = FALSE splitting is not possible (a single response object is returned) and a warning is issued instead.

From NEWS.md in the release

Install

Health

CRAN checks
13OK
Slowest check: 2.6 min · r-oldrel-macos-x86_64
Status changes
  • OK13 OK2026-08-05
  • NOTE12 OK, 1 NOTE2026-08-01
  • OK13 OK2026-05-28
  • ERROR12 OK, 1 ERROR2026-05-27
  • OK14 OK2026-04-09
Show 2 earlier changesHide 2 earlier changes
  • ERROR11 OK, 3 ERROR2026-04-02
  • OK14 OK2026-03-10
Advisories

none known

Documentation

In release 1.0.6
READMEYes · 494 wordsVignettesYes · 5 · dynamicNEWSYes · 100% structured · mentions 1.0.6Citation fileNoWebsiteYes · pkgdown
Help pages
18 (1 internal)includes a package overview page
Examples that run
43%6 run in a plain check (6 of them under a condition) · 8 never run
Exported functions with examples
93%
Documented parameters
100%
Return-value docs
100%
Help pages citing references
0%

Downloads

9.6K
CRAN downloads in the past year
Rank #3,875 · ~26/day · ~798/mo
Daily download trend is not available in this view yet.
99330 days
2.4K90 days
9.6K1 year
Compare downloads with other packages →
Also on208 r2u8 autocran

Repository

85Stars
20Forks
0Open issues
0Open PRs
14Releases
689Commits
10Commit identities
comtradeapisupply-chainrrstatsr-packagepeer-reviewed
689 commits · Last activity 2026-09-19 · +1.2% stars, 30d · Default branch at 1.1.0, ahead of CRAN 1.0.6 (checked 2026-10-18)
Responsiveness
How these are sampled
PRs merged (all time)
94%
Median days to close, 50 most recently updated closed issues
108
Median days to close, 50 most recently updated closed PRs
0

Stars over time

2026-07-14 · 832026-10-10 · 85
PracticesBeta

12 development-tooling and community-health practices detected across 9 families in the upstream repository

Checks run against github.com/ropensci/comtradr on 2026-10-18.

Continuous integration (2)
GitHub ActionsR CMD check workflow

The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel

Governance and community (2)
Code of conductContributing guide
Docs source (2)
README.Rmdpkgdown
Coverage (1)
Coverage reporting (Codecov)
Show all practicesHide 5 practices
Reproducibility and dev environment (1)
data-raw/
CRAN release process (1)
cran-comments.md
Research and citation (1)
codemeta.json
Lint, format, editor (1)
RStudio project
Git structural (1)
.gitattributes
How this is detected·Detection ruleset v3 (2026-09-26)

Dependencies

Declared dependencies
22 external dependencies (excludes base and recommended)

Installing comtradr adds 41 packages (26 with compiled code, 23 MB of source tarballs). Heaviest: stringi 11 MB, fs 1.4 MB, openssl 1.1 MB.

Depends (1)
R >= 4.1.0
LinkingTo (0)
none
Enhances (0)
none
Reverse dependencies
0direct
0indirect
Suggested by 1
Suggests, most downloaded first

Datasets

People & History

People (8)
Author, Maintainer since 0.4.0.0 (2024), Copyright holder · added in 0.4.0.0
Author · added in 0.4.0.0
Contributor · added in 0.3.0
Reviewer · added in 0.4.0.0
Ernest reviewed the package for rOpenSci, see https://github.com/ropensci/software-review/issues/613
Reviewer · added in 0.2.1
Rafael reviewed the package for rOpenSci, see https://github.com/ropensci/onboarding/issues/141
Reviewer · added in 0.4.0.0
Nicholas reviewed the package for rOpenSci, see https://github.com/ropensci/software-review/issues/613
Reviewer · added in 0.2.1
Alicia reviewed the package for rOpenSci, see https://github.com/ropensci/onboarding/issues/141

Previously maintained by Chris Muir (0.0.1 to 0.3.0).

Releases (14)

Pick two releases to compare their code metrics.

  • 1.0.6Latest
    record
    2026-07-30 · current release · diff ↗
  • R
    R 4.6.0 released · 2026-04-24
  • 1.0.5
    record
    2025-12-15 · diff ↗
  • 1.0.4
    record
    2025-09-27 · diff ↗
  • R
    R 4.5.0 released · 2025-04-11
  • 1.0.3
    record
    2024-11-15 · diff ↗
  • 1.0.2
    record
    2024-09-20 · diff ↗
  • unarchivedReturned to CRAN
    2024-05-24
  • 1.0.1
    record
    2024-05-24 · diff ↗ ·
    added 1 export
    ct_migrate_cache
  • archivedRemoved from CRAN
    2024-05-18
    policy violation Uses and leaves files/directories behind in the user's cache directory
  • 1.0.0
    record
    2024-05-14 · diff ↗ ·
    added 1 export
    ct_get_bulk
  • R
    R 4.4.0 released · 2024-04-24
  • unarchivedReturned to CRAN
    2024-02-06
  • 0.4.0.0
    record
    2024-02-06 · diff ↗ ·
    added 4 exports
    ct_get_data, ct_get_ref_table, get_primary_comtrade_key, set_primary_comtrade_key
  • R
    R 4.3.0 released · 2023-04-21
  • archivedRemoved from CRAN
    2023-04-12
    the request of the maintainer
Show 15 earlier eventsHide 15 earlier events
  • R
    R 4.2.0 released · 2022-04-22
  • 0.3.0
    record
    2022-04-20 · diff ↗
  • R
    R 4.1.0 released · 2021-05-18
  • R
    R 4.0.0 released · 2020-04-24
  • R
    R 3.6.0 released · 2019-04-26
  • 0.2.2
    record
    2018-10-05 · diff ↗
  • unarchivedReturned to CRAN
    2018-05-05
  • 0.2.1
    record
    2018-05-05 · diff ↗
  • R
    R 3.5.0 released · 2018-04-23
  • 0.1.0
    record
    2017-10-24 · diff ↗ ·
    removed 4 exports
    commodity_lookup, country_lookup, ct_commodities_table, ct_countries_table
    added 8 exports
    ct_commodity_db_type, ct_commodity_lookup, ct_country_lookup, ct_get_remaining_hourly_queries, ct_get_reset_time, ct_register_token, ct_update_databases, ct_use_pretty_cols
  • 0.0.2
    record
    2017-07-04 · diff ↗
  • archivedRemoved from CRAN
    2017-05-30
    requested by the maintainer <chrismuirRVA@gmail.com>
  • R
    R 3.4.0 released · 2017-04-21
  • 0.0.1
    record
    2017-04-05
  • R
    R 3.3.0 released · 2016-05-03

Package metadata

First published
2017-04-05
Total releases
14 / 9 yrs
License
GPL-3 OSI
Minimum R
≥ 4.1.0
Bundled data
7.0 KB / 2 files
Download size
3.3 MB

Cite

Cite this package

Run in R for the authors' preferred citation:

citation("comtradr")
Bochtler, P., Amann, J., Goers, H., Guevarra, E., Hellwig, R., Muir, C., Potter, N., & Schep, A. (2026). comtradr: Interface with the United Nations Comtrade API (Version 1.0.6) [Computer software]. https://doi.org/10.32614/CRAN.package.comtradr

This package has no citation file, so citation() returns this entry built from DESCRIPTION.

Cite the R Observatory

For a number measured here: a download total, a coverage figure, an archival date.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for comtradr version 1.0.6 [Data set]. HJJB, LLC. Data release v2026-10-21. https://doi.org/10.5281/zenodo.21843040

From data release v2026-10-21, which the citation names so these numbers can be found later. More on citing and the projects behind them.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy