Compare multiple countries' trade in a given commodity, showing exports, imports, balance, and revealed comparative advantage.
Examples
# \donttest{
op <- options(comtrade.cache_dir = tempdir())
cmp <- tryCatch(ct_compare(c("GBR", "DEU", "FRA"), commodity = "87",
year = 2023),
error = function(e) NULL)
#> ℹ No API key set. Using preview endpoint (500 records max, no descriptions).
#> ℹ For full access (100k records, descriptions), get a free key at
#> <https://comtradedeveloper.un.org/>
#> ℹ Then run: `ct_set_key("your-key")`
if (!is.null(cmp)) head(cmp)
options(op)
# }