ct_commodities: Search Commodity Codes

View source: R/reference.R

ct_commoditiesR Documentation

Search Commodity Codes

Description

Search the HS (Harmonized System) commodity classification for codes matching a keyword or code pattern. Uses a built-in table of 96 two-digit HS chapters with descriptions.

Usage

ct_commodities(query = NULL, level = NULL)

Arguments

query

Character. Search term (matched against commodity descriptions) or a partial HS code (e.g., "27" for mineral fuels). Default NULL (return all).

level

Integer. HS digit level to return. Currently only level 2 is available from the built-in table. Default NULL (all levels).

Value

A data.frame with columns:

code

HS 2-digit chapter code

description

Chapter description

level

Digit level (always 2 for built-in table)

parent

Parent code (NA for 2-digit chapters)

Examples

# Search for petroleum-related codes
ct_commodities("petroleum")

# List all 2-digit HS chapters
ct_commodities()

# Find codes starting with "27" (mineral fuels)
ct_commodities("27")

comtrade documentation built on April 13, 2026, 5:07 p.m.