
comexTL
- Language
- R
- Source
- github.com/alanleal-econ/comexTL
remotes::install_github("alanleal-econ/comexTL")
Summary
comexTL gives access to Brazilian foreign trade data from ComexStat (MDIC) directly in R, without manual downloads or file processing.
The package has four modules: reference tables with caching (NCM codes, countries, states, and municipalities); exports by NCM with flexible aggregation; imports with FOB value, freight, insurance, and computed CIF value; and municipal trade by HS4 code and the firm’s municipality.
The package reads Parquet files with Apache Arrow from storage on Cloudflare R2. A multilevel cache speeds up repeated queries and allows offline work. Functions filter by HS level (HS2, HS4, HS6), period, geography (country, state, municipality), logistics (transport mode, customs unit), and economic variables (FOB value, weight, quantity). Derived measures include the share of freight and insurance in imports and the number of distinct municipalities in regional analyses.
The documentation covers basic use, regional comparisons, monitoring dashboards, and integration with other R packages.