Skip to contents

This function retrieves multiple NCM (Nomenclatura Comum do Mercosul) datasets from the comexstat package, merges them into a single data frame, and converts all columns to character format.

Usage

ncms(files = c("ncm", "ncm_cgce", "ncm_cuci", "ncm_isic", "ncm_unidade"))

Arguments

files

A character vector specifying the names of the NCM datasets to retrieve from comexstat. Defaults to c('ncm', 'ncm_cgce', 'ncm_cuci', 'ncm_isic', 'ncm_unidade').

Value

A merged data frame containing all specified NCM datasets, with all columns converted to character format.

Details

This function streamlines the process of working with multiple NCM datasets from the comexstat package. It performs the following steps:

  1. Retrieval: Retrieves the specified NCM datasets using the comex function.

  2. Merging: Combines all retrieved datasets into a single data frame using left joins.

  3. Format Conversion: Converts all columns in the merged data frame to character format for consistent data manipulation.

The function suppresses messages and warnings during the retrieval and merging steps to provide a cleaner output.

Examples

if (FALSE) { # \dontrun{
# Merge and format default NCM datasets
merged_ncms <- ncms()

# Merge specific NCM datasets (e.g., only 'ncm' and 'ncm_cuci')
merged_ncms <- ncms(files = c('ncm', 'ncm_cuci'))
} # }