brfinance

brfinance is a simple R package that provides easy access to macroeconomic data from Brazil, such as the basic interest rate (SELIC) and the unemployment rate, using official sources like the Central Bank of Brazil (BCB) and the Brazilian Institute of Geography and Statistics (IBGE) via SIDRA.

This package is part of an effort to simplify the retrieval and visualization of Brazilian macroeconomic indicators directly in R, and soon visualizations of financial market trends.

Installation

You can install the development version from GitHub with:

install.packages("devtools")  # if not installed
devtools::install_github("efram2/brfinance")

Usage

The package provides separate functions for data retrieval and visualization:

library(brfinance)

# Example 1: SELIC rate (English)
selic_data <- get_selic_rate(2020, 2024)
selic_plot <- plot_selic_rate(selic_data)
print(selic_plot)

# Example 2: Unemployment rate (English)
unemployment_data <- get_unemployment(2020, 2024)
unemployment_plot <- plot_unemployment(unemployment_data)
print(unemployment_plot)

# Example 3: Portuguese versions
dados_selic <- get_selic_rate(2020, 2024, language = "pt")
grafico_selic <- plot_selic_rate(dados_selic, language = "pt")
print(grafico_selic)

Available Functions

get_selic_rate(start_year, end_year, language = “eng”)

get_unemployment(start_year, end_year, language = “eng”)

Visualization Functions

plot_selic_rate(data, language = “eng”)

plot_unemployment(data, language = “eng”)

Language Support

All functions support both English and Portuguese through the language parameter:

About the data

All data used in brfinance is retrieved from official Brazilian institutions:

The package aims to simplify the access and visualization of key Brazilian macroeconomic indicators, especially for researchers, students, and analysts who work with national economic data.

Contribution

Suggestions, feature requests, and pull requests are welcome!