knitr::opts_chunk$set(echo = TRUE)

Description

This package provides a single function that takes an .iqy file generated by the Statistical Database of the Central Bank of Chile, and returns a data frame with the results of the query.

The main benefit of working with .iqy files is that you can easily update your data by using the query parameters, so that you do not need to access the BCCh site every time you want to obtain the latest data available. Also, it is important to note that, while these files were designed to work with Microsoft Excel, you don't actually need to have this program installed on your computer to be able to use .iqy files with BCChqRy.

Installation

if (!require(devtools)) {
    install.packages('devtools')
}
devtools::install_github('miguelbiron/BCChqRy')

Example

In this brief example, I assume you have downloaded and placed in your working directory the UF_IVP_DIARIO.iqy file associated with the query "Precios" > "UF - IVP - UTM" > "UF-IVP diario" in the BCCh database. For this file, we know that the query parameters are the initial and final year for the data requested. In fact, this is the case for every .iqy file from the BCCh that I have tested. Therefore, we pass these to the q_values argument.

library(BCChqRy)
suppressPackageStartupMessages(library(dplyr))

get_bcch_data("UF_IVP_DIARIO.iqy", q_values = c(2018, 2018)) %>% 
  head() %>% 
  knitr::kable()

How to get an .iqy file from the BCCh database

As you navigate the database, you will eventually arrive at a dataset that you'd like to download, including an appropriate frequency ("frecuencia") and calculation ("calculo"). Now, simply click the Mi BDE button located in the upper-right corner above the data table. This will download the .iqy file associated with the data you requested, which you can then use in R with BCChqRy.

TODO



miguelbiron/BCChqRy documentation built on Sept. 17, 2022, 3:40 a.m.