Tableau + R
In this guide we’ll explore how to easily set up your own R Server and get it connected to Tableau. Then we’ll step through a few exercises highlighting some of my favorite R packages for use within Tableau
Let’s face it, Tableau’s out of the box “Advanced Analytics” offering is quite rudimentary. Having worked with many clients spanning most industries, one thing I’ve come to learn is that the trend line is about as far as most folks take it. There’s nothing advanced about that.
Tableau is in the business of Data Visualization, not Advanced Analytics. They understood their particular shortcoming and made the decision to open the doors for R integration (as of Tableau 8.1). This provided users the opportunity to pass their more Advanced Analytics off to a service whose sole purpose was to render predictive analytics.
Today, we’ll work on setting up our very own R Server in the cloud and work through some fun use cases that demonstrate a few of the most powerful R packages available for use within Tableau.
Before we dive in, here’s a brief summary to demonstrate how we go from Tableau -> R Server -> Tableau:
Tableau allows you to embed R code right into a traditional Calculated Field. This field will be communicating externally (external service) as the code within the calc field contains a SCRIPT_*() function. The fields within your dataset and the accompanying data are referenced within this SCRIPT function.
When this calc field gets executed in Tableau (added anywhere on your sheet canvas), both the R code and associated data are sent to an Rserve session. At this point, all the magic is happening external to Tableau and running on your R Server.
The R code will produce a single vector and pass it back from the external R server to Tableau. The resulting vector is then displayed using a Tableau Table Calculation (the only option) as it’s vessel for communicating back your results, visually.