Skip to content

comtradr

Interface with the United Nations Comtrade API

v1.0.5 · Dec 15, 2025 · GPL-3

Description

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.

Downloads

995

Last 30 days

3810th

2.4K

Last 90 days

11.1K

Last year

Trend: +23.8% (30d vs prior 30d)

CRAN Check Status

1 ERROR
13 OK
Show all 14 flavors
Flavor Status
r-devel-linux-x86_64-debian-clang OK
r-devel-linux-x86_64-debian-gcc OK
r-devel-linux-x86_64-fedora-clang OK
r-devel-linux-x86_64-fedora-gcc OK
r-devel-macos-arm64 OK
r-devel-windows-x86_64 OK
r-oldrel-macos-arm64 OK
r-oldrel-macos-x86_64 OK
r-oldrel-windows-x86_64 OK
r-patched-linux-x86_64 ERROR
r-release-linux-x86_64 OK
r-release-macos-arm64 OK
r-release-macos-x86_64 OK
r-release-windows-x86_64 OK
Check details (1 non-OK)
ERROR r-patched-linux-x86_64

tests

Running ‘spelling.R’ [0s/0s]
  Running ‘testthat.R’ [9s/14s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > # This file is part of the standard setup for testthat.
  > # It is recommended that you do not modify it.
  > #
  > # Where should you do additional test configuration?
  > # Learn more about the roles of various files in:
  > # * https://r-pkgs.org/tests.html
  > # * https://testthat.r-lib.org/reference/test_package.html#special-files
  > 
  > library(testthat)
  > library(comtradr)
  > 
  > test_check("comtradr")
  Saving _problems/test-utils-274.R
  [ FAIL 1 | WARN 0 | SKIP 11 | PASS 293 ]
  
  ══ Skipped tests (11) ══════════════════════════════════════════════════════════
  • On CRAN (9): 'test-ct_perform_request.R:7:5',
    'test-ct_perform_request.R:30:5', 'test-ct_perform_request.R:55:5',
    'test-ct_perform_request.R:70:5', 'test-ct_perform_request.R:85:5',
    'test-ct_perform_request.R:107:5', 'test-ct_perform_request.R:131:5',
    'test-ct_perf
...[truncated]...
 'test-ct_get_bulk.R:83:3', 'test-ct_get_data.R:96:3'
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error ('test-utils.R:274:3'): update flag prevents repeated downloads in same session ──
  <httr2_failure/httr2_error/rlang_error/error/condition>
  Error in `httr2::req_perform(httr2::request(datasets$fileuri))`: Failed to perform HTTP request.
  Caused by error in `curl::curl_fetch_memory()`:
  ! Failure when receiving data from the peer [comtradeapi.un.org]:
  Recv failure: Connection reset by peer
  Backtrace:
      ▆
   1. └─comtradr::ct_get_ref_table("flow_direction", update = TRUE) at test-utils.R:274:3
   2.   └─comtradr:::ct_download_ref_table(ref_table_id = ref_table_id)
   3.     └─httr2::req_perform(httr2::request(datasets$fileuri))
   4.       └─httr2:::handle_resp(req, resp, error_call = error_call)
   5.         └─rlang::cnd_signal(resp)
  
  [ FAIL 1 | WARN 0 | SKIP 11 | PASS 293 ]
  Error:
  ! Test failures.
  Execution halted

Check History

ERROR 11 OK · 0 NOTE · 0 WARNING · 3 ERROR · 0 FAILURE Apr 2, 2026
ERROR r-devel-linux-x86_64-debian-gcc

tests

Running ‘spelling.R’ [0s/0s]
  Running ‘testthat.R’ [7s/19s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > # This file is part of the standard setup for testthat.
  > # It is recommended that you do not modify it.
  > #
  > # W
...[truncated]...
::req_perform(httr2::request(datasets$fileuri))
   4.       └─httr2:::handle_resp(req, resp, error_call = error_call)
   5.         └─rlang::cnd_signal(resp)
  
  [ FAIL 1 | WARN 0 | SKIP 11 | PASS 293 ]
  Error:
  ! Test failures.
  Execution halted
ERROR r-devel-windows-x86_64

tests

Running 'spelling.R' [0s]
  Running 'testthat.R' [20s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
  > # This file is part of the standard setup for testthat.
  > # It is recommended that you do not modify it.
  > #
  > # Where s
...[truncated]...
::req_perform(httr2::request(datasets$fileuri))
   4.       └─httr2:::handle_resp(req, resp, error_call = error_call)
   5.         └─rlang::cnd_signal(resp)
  
  [ FAIL 1 | WARN 0 | SKIP 11 | PASS 293 ]
  Error:
  ! Test failures.
  Execution halted
ERROR r-patched-linux-x86_64

tests

Running ‘spelling.R’ [0s/0s]
  Running ‘testthat.R’ [9s/14s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > # This file is part of the standard setup for testthat.
  > # It is recommended that you do not modify it.
  > #
  > # W
...[truncated]...
::req_perform(httr2::request(datasets$fileuri))
   4.       └─httr2:::handle_resp(req, resp, error_call = error_call)
   5.         └─rlang::cnd_signal(resp)
  
  [ FAIL 1 | WARN 0 | SKIP 11 | PASS 293 ]
  Error:
  ! Test failures.
  Execution halted
OK 14 OK · 0 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE Mar 10, 2026

Dependency Network

Dependencies Reverse dependencies lifecycle fs readr askpass cli httr2 rlang stringr poorman lubridate purrr rappdirs memoise cachem comtradr

Version History

new 1.0.5 Mar 10, 2026
updated 1.0.5 ← 1.0.4 diff Dec 14, 2025
updated 1.0.4 ← 1.0.3 diff Sep 26, 2025
updated 1.0.3 ← 1.0.2 diff Nov 14, 2024
updated 1.0.2 ← 1.0.1 diff Sep 19, 2024
updated 1.0.1 ← 1.0.0 diff May 23, 2024
updated 1.0.0 ← 0.4.0.0 diff May 13, 2024
updated 0.4.0.0 ← 0.3.0 diff Feb 5, 2024
updated 0.3.0 ← 0.2.2 diff Apr 19, 2022
updated 0.2.2 ← 0.2.1 diff Oct 4, 2018
updated 0.2.1 ← 0.1.0 diff May 4, 2018
updated 0.1.0 ← 0.0.2 diff Oct 23, 2017
updated 0.0.2 ← 0.0.1 diff Jul 3, 2017
new 0.0.1 Apr 4, 2017