Site icon R-bloggers

Shiny/R Conversion of Another One of My Favorite Mike Bostock d3 Examples

[This article was first published on Timely Portfolio, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Mike Bostock has revolutionized visualization with his d3 and his seemingly infinite examples.  In another adaptation of his amazing work, I will adapt one of my favorite examples to supplement the interactive scatterplot with data supplied by R through Shiny.  Often in finance, we will use a scatterplot to explore the relationship between different asset classes or risk exposures.  This exploration becomes much more deep and meaningful when we can interact in real-time with the plot.

I thought using the technique to look at the monthly returns of Vanguard funds representing different exposures would be helpful.  A clear linear relationship immediately shows up between the equity funds (VFINX-Vanguard S&P 500, VDMIX-Vanguard Developed Markets, and VEIEX-Vanguard Emerging Markets).  Also, we can see the very beneficial effect of VBMFX-Vanguard Total US Bond throughout what we know was a tumultuous period.

Live example hosted at Glimmer (IE does not correctly render IFRAME below)

Code at Github

To leave a comment for the author, please follow the link and comment on their blog: Timely Portfolio.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.