Visualising Asian Bond Markets Data Using R
The AsianBondsOnline portal of the ASEAN+3 Asian Bond Markets Initiative is a great resource for information on Asian bond markets. Whether it's market size, currency denomination, pricing information, or liquidity stats, this platform's got you covered. I often need a quick snapshot of the market, so I put together an R script to make life easier. This script fetches the latest data on local and foreign currency bonds from AsianBondsOnline, aggregates it for government and corporate bonds, and generates static and interactive graphs.
Grab the script here and open it up in your favourite R IDE. The script is organised into sections, starting with the one that loads all necessary packages. If you're missing any of the packages listed here, just run install.packages("packagename")
. To install RCurl, for example, just run install.packages("RCurl")
. Next, we pull in the data from AsianBondsOnline, specifically focusing on local currency and foreign currency bond markets. We then merge and subset this data before calculating bonds outstanding relative to GDP. Finally, we plot the results using the fantastic ggplot2 package. We also generate an interactive plot with plotly. Check it out here. The interactive graph lets you toggle specific series on and off, giving you a clearer view on which series drive change in the totals.
Get the R script here. Get the interactive chart here.
Links
- AsianBondsOnline offers a wealth of statistics and information on Asian bond markets.
- AsianBondsOnline data portal.
- Find more information on the ASEAN+3 Asian Bond Markets Initiative here.
- ggplot2 reference provides detailed documentation of ggplot2.
- plotly R reference provides an introduction to plotly with examples.