Creating a BIS Data Dashboard Using RMarkdown and Flexdashboard

Sometimes, I need a quick overview of a large dataset for a particular economy. For example, I might want to examine all the available data from the Bank for International Settlements (BIS) for the U.K. Compiling the relevant data from their various datasets can be quite the task, so making the process replicable is key. This post shows you how to set up an interactive BIS data dashboard using R Markdown, and flexdashboard together with the BIS R package.px.gif

bisdashboard01.png

Update (3 August 2024): The BIS R package has been discontinued, and the structure of the BIS homepage has changed, so the code below will need refactoring to work. I'm keeping these instructions up unchanged for future reference as the code can help understand the structure of BIS data.

The code utilizes the BIS R package to download raw data from the BIS, which is then subsetted and reshaped for a user-specified country. This data is then used to generate interactive plotly graphs to populate an dashboard based on flexdashboard. All of this is based on R Markdown

Follow the installation instructions below to get started.

Download the source code:

How to use the code

  1. Grab copies of bis_dashboard.Rmd, bis_helper_functions.R, and refresh_bis_data.R. Save them in a folder of your choice. Open R and set that folder as your working directory.

    setwd("/home/user/path/to/bisdashboard")
    
  2. Source the file refresh_bis_data.R to download raw data from the BIS and save it in a local .RData file. This file will function as a local cache to avoid unnecessary calls to the BIS's servers. You will need to run this command again every time you want to update your dashboard for the latest data.

    source("refresh_bis_data.R")
    
  3. Once you have the data, call rmarkdown's render() function to create a dashboard for an economy of your choice, identified by ISO 2-character code, e.g., “JP” for Japan.

    rmarkdown::render("bis_dashboard.Rmd", params = list(ctr = "JP"), output_file = "bis_dashboard_JP.html")
    
  4. When this is complete, open the HTML file produced by rmarkdown (bis_dashboard_JP.html in the above example). Note that the file may take a moment to load, depending on the amount of data to display.

For examples, check out these dashboards:

The dashboard will give you a set of charts for a user-specified economy as well as the global economy. The presentation is fairly self-explanatory and broadly sticks to the BIS's abbreviations. By default, exchange rate data are based on nominal effective exchange rates which cover fewer countries but provide longer history. Bank liabilities are shown with a negative sign. Domestic debt securities are calculated as the difference between total and international debt securities as some economies do not report them separately. The code is easily adapted for other use cases.

This dashboard is not officially related to, or endorsed by, the BIS. The code comes with no warranty.

More information