---
title: "COMEX"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{COMEX}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
The Comex dataset gathers data extracted from [Siscomex (Integrated System of Foreign Trade)](https://www.gov.br/produtividade-e-comercio-exterior/pt-br/assuntos/comercio-exterior/estatisticas/base-de-dados-bruta/), which is a database containing information from all products that are imported to or exported from Brazil. Using data reported from the companies which are responsible for the process of transporting the products, the system adheres to internationally standardized nomenclatures, such as the Harmonized System and the Mercosul Common Nomenclature (which pertains to members of the Mercosul organization).
The data has a monthly frequency and is available starting from the year 1989. From 1989 to 1996, a different system of nomenclatures was adopted, but all conversions are available on a dictionary in the Comex website (https://www.gov.br/produtividade-e-comercio-exterior/pt-br/assuntos/comercio-exterior/estatisticas/base-de-dados-bruta/). Systems of nomenclature vary in the degree of detail in terms of the product involved, as well as other characteristics, such as unit and granularity of location.
***
**Options:**
1. **dataset**: there are four choices:
* `"comex_export_mun"`: selects exports data by municipality
* `"comex_import_mun"`: selects imports data by municipality
* `"comex_export_prod"`: selects exports data by producer
* `"comex_import_prod"`: selects imports data by producer
2. **raw_data**: there are two options:
* `TRUE`: if you want the data as it is originally.
* `FALSE`: if you want the treated version of the data.
3. **time_period**: picks the years for which the data will be downloaded
4. **language**: you can choose between Portuguese `("pt")` and English `("eng")`
***
**Examples:**
```{r, eval = FALSE}
# download treated (raw_data = FALSE) exports data by municipality (dataset = "comex_export_mun")
# from 2020 to 2021 (time_period = 2020:2021)
data <- load_br_trade(
dataset = "comex_export_mun",
raw_data = FALSE,
time_period = 2020:2021
)
# download treated(raw_data = FALSE) imports data by municipality (dataset = "comex_import_mun")
# from 2020 to 2021 (time_period = 2020:2021)
data <- load_br_trade(
dataset = "comex_import_mun",
raw_data = FALSE,
time_period = 2020:2021
)
```