| ct_hhi | R Documentation |
Compute the Herfindahl-Hirschman Index measuring the concentration of a country's trade across partners or products.
ct_hhi(
reporter,
flow = "X",
year = NULL,
by = "partner",
level = 2L,
cache = TRUE
)
reporter |
Character. Reporter country ISO3 code. |
flow |
Character. |
year |
Integer. Year to query. |
by |
Character. Concentrate by |
level |
Integer. HS digit level (only used when |
cache |
Logical. Default |
HHI ranges from 0 (perfectly diversified) to 10,000 (single partner/product). Interpretation: < 1,500 = low concentration, 1,500-2,500 = moderate, > 2,500 = high.
A data.frame with columns: year, hhi, concentration, n_items, top_item, top_share_pct.
op <- options(comtrade.cache_dir = tempdir())
# Export partner concentration
ct_hhi("AUS", flow = "X", year = 2023, by = "partner")
# Export product concentration
ct_hhi("AUS", flow = "X", year = 2023, by = "product")
options(op)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.