Integrating Tableau and R for Data Analytics
Tableabu is one of the most popular Business Intelligence tool while R is hottest statistical analysis software(At least in school yard). Tableau is able to handle various data sources such as SQL, Google Analytics, Excel, CSV and Hadoop. R performs quite well when the dataset is smaller than 1G. How to combine Tableau's computation power with R's all-inclusive statistical package? Here comes the solution.
Steps
Tableau 9 provide users the function to connect with a Rserver, from where you could access R's functions.
Set up Rserver.Open you R or R studio and run the following cmd.
install.packages("Rserve") library("Rserve") Rserve(args="--save")#if you are using macConnect Rserver with Tableau.
- Help --Settings and Performance ---Manage R connection <Connection.png>
Example
Now, your Tableau is connected with R and you could use R function to analyse Tableau data.
Here we are going to use fisher's iris data as an example. This dataset contains 5 columns, sepal length, sepal width, pedal length, pedal width and species. Fisher initially collected it for classify flowers by the first four attributes.
Drag variables in Tableau like this
Then add a calculated field -- Cluster. Right Click Measures and select add a calucalted filed.
Created filed by writing the following script.
SCRIPT_INT() function means this R script returns an int. Those quoted elements is an r script. This script takes SUM(F1),SUM(F2),SUM(F3),SUM(F4) as inputs and return the result of k-means classfication.
Drag the Cluster into color and you get final result.
This is just an simple example of integrating R and Tableau, there might be more wonderful stuff that are awaiting.