ct_top_products: Top Export or Import Products

View source: R/analytics.R

ct_top_productsR Documentation

Top Export or Import Products

Description

Rank a country's traded products by value, showing the top N with percentage shares.

Usage

ct_top_products(
  reporter,
  flow = "X",
  year = NULL,
  n = 20L,
  level = 2L,
  cache = TRUE
)

Arguments

reporter

Character. Reporter country ISO3 code.

flow

Character. "X" for exports, "M" for imports.

year

Integer. Year to query.

n

Integer. Number of top products to return. Default 20.

level

Integer. HS digit level: 2, 4, or 6. Default 2.

cache

Logical. Default TRUE.

Value

A data.frame with columns: commodity_code, commodity_desc, value, share_pct, rank.

Examples


op <- options(comtrade.cache_dir = tempdir())
ct_top_products("AUS", flow = "X", year = 2023)
options(op)


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