paint-brush
js-challenged R-coder to build interactive visualization? Flexdashoard to rescueby@amrwrites
174 reads

js-challenged R-coder to build interactive visualization? Flexdashoard to rescue

by AMRMarch 13th, 2017
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

<strong>The Problem:</strong>
featured image - js-challenged R-coder to build interactive visualization? Flexdashoard to rescue
AMR HackerNoon profile picture

The Problem:

The biggest problem with I-am-an-R-coder Data Scientists is the big wall they hit when it comes to Web-friendly Interactive Visualization. Because in most of the organizations, Data Scientists’ role not just involve building sophisticated statistical models but more to do with extracting valuable insights out of the data chunk — whose end result is a (nice) visualization.

The world hasn’t completely ruled out Powerpoint presentations, yet the need of the hour is Interactive Dashboards, because less is more — showing an information only on mouse hover is a lot better than having those values carved on the chart and interactive visualization also enables the analyst stuff-in more information (that reveals itself when required) than a static image.

The Rescue-Plan:

But being an R-dominant Data Scientist, especially js-challenged ones, the world of mobile-friendly interactive visualizations suddenly become blank and that’s when you’ve to know, there’s something called ‘Flexdashboard for R’ and it’s going to save you!

flexdashboard: Easy interactive dashboards for R

While flexdashboard has a lot of good properties, 2 things I’d like to call out:

  1. It’s support to include htmlwidgets

htmlwidgets for R

2. Flexible layouts (similar to bootstrap)

Sample flexdashboard Layouts

While the former brings the world of js-visualization libraries to the hands of R-programmer, the latter helps in laying them out in a responsive (mobile-friendly) grid layout. The documentation makes it extremely easier to start with the desired layout (unless there’s a very complex business requirement which is highly unlikely since it’s not a full-fledged dashboard)

## Markdown Code to create an interactive heatmap using d3heatmap 

```
library(knitr) 
library(d3heatmap) 
library(flexdashboard)

url <- "http://datasets.flowingdata.com/ppg2008.csv" 
nba_players <- read.csv(url, row.names = 1) 
```  

### Stats by Player {data-width=650}  
```{r} 
d3heatmap(nba_players, scale = "column") 
```

And, The Delivery:

Screenshot of Interactive Heatmap generated with above code snippet

And once the visualization is built, there are two easy options for deploying it:

  1. R-Shiny App
  2. Rmarkdown knitted (as HTML)

With a very little learning curve (skimming through the documentation and the ability to understand the functions & paramters of required htmlwidgets) and zero knowledge about javascript,

Flexdashboard enables R-only Data Scientists deploy interactive visualizations (just like a js-wizard would do — at least with less customization)