ipeadatar R package

API Wrapper for Ipeadata

Luiz Eduardo S. Gomes1

Jessyka A. P. Goltara2

Introduction

This R package is an easier alternative to use the data set of Brazilian Institute for Applied Economic Research (Ipea). It allows directly access to the macroeconomic, financial and regional databases. This package helps you to find the series you’re looking for without the need to go on the Ipeadata website to find it and downloading it. This is a practical way to use the Ipea databases on R.

How to install and load the ipeadatar R package

Via CRAN

install.packages("ipeadatar")
library(ipeadatar)

Via Github

library(devtools)
install_github("gomesleduardo/ipeadatar")
library(ipeadatar)

Functions

Functions Outputs
available_countries List with available countries
available_series List with available series
available_subjects List with available subjects
available_territories List with available territorial divisions
ipeadata Returns a database about the requested series
metadata Returns a metadata about the requested series
search_series List with searched series

Examples

1. available_series

This function will show the available series in the Ipeadata site. One of the output variable of this function is the code. So, this is one way of getting the code for the the functions metadata and ipeadata.

2. search_series

To simplify, this function will help you to find the series you’ve been searching for faster. Let’s say that you are looking for databases about nominal exchange rate (or taxa de câmbio nominal, in Portuguese). All you have to do is to type a keyword on the parameter terms:

ipeadatar::search_series(terms = 'Taxa de câmbio nominal', fields = c('name'))

Or maybe, you’re looking for all active series:

ipeadatar::search_series(terms = 'Active', fields = c('status'))

3. metadata

Let’s say you want information about IPCA (Broad Consumer Price Index – official inflation index in Brazil) and you’ve found that the code of this series is 'PRECOS12_IPCA12'. Therefore, that’s how you get the metadata of this series:

metadata('PRECOS12_IPCA12')

4. ipeadata

With the help of this function, we get the values of the IPCA. Its frequency is monthly. So, let’s see with the help of the following graphic:

Now, you search for information about the homicide rate (per 100.000 inhabitants) in Brazilian states from 1995 to 2010. This is what you should do:

homic_rate1995 <- 
ipeadata("THOMIC") %>% 
filter(uname == "States" & date == "1995-01-01")

homic_rate2000 <- 
ipeadata("THOMIC") %>% 
filter(uname == "States" & date == "2000-01-01")

homic_rate2005 <- 
ipeadata("THOMIC") %>% 
filter(uname == "States" & date == "2005-01-01")

homic_rate2010 <- 
ipeadata("THOMIC") %>% 
filter(uname == "States" & date == "2010-01-01")

Let’s see a graphic with this information:

Finally, you looking for the evolution of the average years of schooling for people 25 years of age or older in Brazilian Mesoregions between the 90’s and 00’s:

avg_yschol1991 <-
  ipeadata("MEDUCA") %>%
  filter(uname == "Mesoregions" & date == "1991-01-01")

avg_yschol2000 <-
  ipeadata("MEDUCA") %>%
  filter(uname == "Mesoregions" & date == "2000-01-01")

  1. Luiz Eduardo S. Gomes is currently a Ph.D. student in Statistics at Federal University of Rio de Janeiro (UFRJ – Rio de Janeiro, RJ, Brazil) and data analysis assistant at Ipeadata. His Github page and institutional e-mail.↩︎

  2. Jessyka A. P. Goltara is currently a M.Sc. candidate in Computer Science at Federal Fluminense University (UFF – Niterói, RJ, Brazil) and research assistant at Ipea. Her Github page and institutional e-mail.↩︎