Learn R Programming

BrazilDataAPI

The BrazilDataAPI package provides a unified interface to access open data from the BrasilAPI and the REST Countries API, with a focus on Brazil. It allows users to easily retrieve up-to-date information on postal codes, banks, economic indicators, holidays, company registrations, and international country-level data relevant to Brazil.

In addition to API-access functions, the package includes a collection of curated datasets related to Brazil, covering diverse domains such as demographics (male and female population by state and year), river levels in Manaus, environmental emission factors in São Paulo, Brazilian film festivals, and historical yellow fever outbreaks.

BrazilDataAPI is designed to support research, teaching, and data analysis focused on Brazil by integrating public RESTful APIs with high-quality, domain-specific datasets into a single, easy-to-use R package.

Installation

You can install the BrazilDataAPI package from CRAN with the following R function:


install.packages("BrazilDataAPI")

Usage

After installation, load the package and start exploring and using its functions and datasets.


library(BrazilDataAPI)

BrazilDataAPI Functions

  • get_brazil_banks(): Get List of Banks in Brazil

  • get_brazil_cep(): Get Address Information by Brazilian CEP (Postal Code)

Example: get_brazil_cep("89010025")

  • get_brazil_cnpj(): Get Company Information by CNPJ (Brazil)

Example: get_brazil_cnpj("19131243000197")

  • get_brazil_municipalities(): Get Municipalities of a Brazilian State from IBGE

Example: get_brazil_municipalities("SP")

  • get_brazil_rate_name(): Get Specific Brazilian Economic Rate by Name

Example: get_brazil_rate_name("CDI")

  • get_brazil_rates(): Get Official Interest Rates and Indexes from Brazil

  • get_brazil_vehicle_brands(): Get Vehicle Brands from BrasilAPI (FIPE Data)

Example: get_brazil_vehicle_brands("motos"),get_brazil_vehicle_brands("caminhoes")

  • get_country_info(): Get essential information about Brazil or any other country by its full name

Example: get_country_info("Brazil"),get_country_info("brazil"),get_country_info("Peru")

  • view_datasets_BrazilDataAPI(): Lists all curated datasets included in the BrazilDataAPI package

Some of the BrazilDataAPI Datasets

The naming convention helps you easily understand the structure of each dataset:

  • _df: A standard data frame.

  • _ts: A time series object.

  • _list: A list object.

  • Brasil_females_df: Brazilian Female Demographics & Mortality

A data frame containing population counts and mortality information for females in Brazil, disaggregated by federal states and abridged age groups, for the years 1991 and 2000.

  • manaus_ts: Monthly Average Heights of the Rio Negro at Manaus

A univariate time series of monthly average river heights of the Rio Negro at Manaus. The series contains 1080 observations spanning 90 years, from January 1903 to December 1992.

  • Yellow_Fever_list: Yellow Fever Outbreak in Brazil

A list object containing information on the flow of Yellow Fever cases between five Brazilian states during the outbreak period from December 2016 to May 2017.

Example Code:


# Load the package
library(BrazilDataAPI)

# Selected, essential information about Brazil
get_country_info()

# Get List of Banks in Brazil
get_brazil_banks()

# Load a dataset
data("Brasil_females_df")

# Shows six rows of the dataset
head(Brasil_females_df)

# Display the structure of the dataset
str(Brasil_females_df)

# Shows the whole dataset

View(Brasil_females_df)

Copy Link

Version

Install

install.packages('BrazilDataAPI')

Monthly Downloads

509

Version

0.1.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Renzo Caceres Rossi

Last Published

July 9th, 2025

Functions in BrazilDataAPI (0.1.0)

get_brazil_rates

Get Official Interest Rates and Indexes from Brazil
get_brazil_vehicle_brands

Get Vehicle Brands from BrasilAPI (FIPE Data)
Brasil_females_df

Brazilian Female Demographics & Mortality (1991-2000)
BrazilDataAPI

BrazilDataAPI: Access Brazilian Economic, Demographic, Environmental, and Geopolitical Data via RESTful APIs and Curated Datasets
get_brazil_cnpj

Get Company Information by CNPJ (Brazil)
get_brazil_municipalities

Get Municipalities of a Brazilian State from IBGE
Brasil_males_df

Brazilian Male Demographics & Mortality (1980-1991)
Brazil_films_df

Films Shown at Brazilian Film Festivals (2007–2011)
get_brazil_cep

Get Address Information by Brazilian CEP (Postal Code)
get_brazil_rate_name

Get Specific Brazilian Economic Rate by Name
Yellow_Fever_list

Yellow Fever Outbreak in Brazil (Dec 2016 – May 2017)
get_brazil_banks

Get List of Banks in Brazil
view_datasets_BrazilDataAPI

View Available Datasets in BrazilDataAPI
sp_emission_factors_df

Emission Factors from the Environmental Agency of São Paulo (CETESB)
get_country_info

Get Key Country Information from the REST Countries API
manaus_ts

Monthly Average Heights of the Rio Negro at Manaus (1903–1992)