A General Introduction to r2d3: R Interface to D3 Visualization Tools

T Z J Y
6 min readSep 30, 2021

Most serious data scientists prefer R to Python, but if you work on production in data science or machine learning, you’re probably going to have to put your partiality to R aside. In fact, there has been years of debate whether people should use R or Python.

It’s out of question that Python is more favoured than R, given a lot of advantages Python brings to the table. However, for pure data science and enriched visualization packages, R still has a slight edge over Python, even though the gap has closed significantly over past years.

Historically R has had a wider variety of packages for statistical analysis and visualisation. Popular libraries include dplyr, zoo and ggplot2; and there are dozens more. Among them there is one package that provides a suite of tools for using D3 visualisations with R: r2d3.

What Is r2d3?

The r2d3 package enriches R users with an extensive visualization functions inside R, including the ability to render D3 visuals in Shiny apps and add them in R markdown documents as well as Shiny Web publication. The visualisations work just like any other R plots within R Studio, R Markdown documents and Shiny applications. Here are a few examples, and many more can be found from r2d3 Gallery!

--

--