COMEX

Overview

COMEX (Comércio Exterior - Foreign Trade) dataset provides Brazil’s official international trade statistics extracted from Siscomex, the Integrated System of Foreign Trade maintained by the Brazilian government.

This dataset captures:

COMEX is the primary official source for Brazil’s international trade statistics, widely used for trade policy analysis, business intelligence, academic research, and economic monitoring.

Data Source and Coverage

COMEX data comes from: - Official records from Siscomex (Brazil’s foreign trade system) - Mandatory declarations by exporters and importers - Updated monthly with current month data - Historical data from 1989 onwards

Important note on nomenclature: From 1989 to 1996, Brazil used a different system of product nomenclature (NBLC - Nomenclatura Brasileira de Mercadorias). All conversions to the current nomenclature system are available and the package handles this transparently.

For more information, visit the Brazilian Ministry of Productivity, Employment and Foreign Trade.


Available Datasets

1. export_mun (Exports by Municipality)

Export data disaggregated at the municipality level.

2. import_mun (Imports by Municipality)

Import data disaggregated at the municipality level.

3. export_prod (Exports by Producer)

Export data organized by producer/exporter and product.

4. import_prod (Imports by Producer)

Import data organized by importer/distributor and product.


Function Parameters

1. dataset

Selects which trade dataset to download.

dataset = "export_mun"   # exports by municipality
dataset = "import_mun"   # imports by municipality
dataset = "export_prod"  # exports by producer/exporter
dataset = "import_prod"  # imports by producer/importer

2. raw_data

Controls whether to download the original data or the processed/cleaned version.

raw_data = FALSE  # logical

3. time_period

Specifies which year(s) to download. Available from 1989 onwards.

time_period = 2020              # single year
time_period = c(2018, 2020)     # specific years
time_period = 2015:2020         # range of years

Note: Monthly data means each year can be quite large. Consider downloading specific years or ranges to manage file size.

4. language

Output language for variable names and documentation.

language = "eng"  # character string

Examples

# download treated exports data by municipality from 2020 to 2021
data <- load_br_trade(
  dataset = "export_mun",
  raw_data = FALSE,
  time_period = 2020:2021,
  language = "eng"
)

# download treated imports data by municipality from 2020 to 2021
data <- load_br_trade(
  dataset = "import_mun",
  raw_data = FALSE,
  time_period = 2020:2021,
  language = "eng"
)

Data Notes

Raw vs. Treated Data

Product Classification

Data Characteristics

  1. Monthly frequency: Data is reported monthly; aggregation to annual or quarterly is straightforward
  2. Producer vs. Municipality:
    • Municipality data groups trade by geographic origin/destination
    • Producer data groups by firm/exporter-importer code
    • Use municipality for regional analysis, producer for firm analysis
  3. Missing data: Some small trade flows may not be reported
  4. Currency: All values in USD

Nomenclature Conversion

When using data spanning 1989-1996 to 1997 onwards, be aware: - Product categories may differ between nomenclature systems - Conversions are available but not always 1:1 - Compare very old with recent data with caution