Integrate R with Tableau

by Liu Zhang
Coronavirus coverage as of 3/15/2020. Heatmap by the Center for Systems Science and Engineering (CSSE) at John Hopkins University -

(IG: @clay.banks)
Photo by Clay Banks / Unsplash
Using R and Tableau
Tableau can now connect to R through calculated fields and take advantage of R functions, libraries, packages, and even saved models.
Check out the Tableau official article on it

Install, Setup and Connection:

Install in R:

There are multiple ways to install package in R, personally I use the following

Tools - Install Packages
Type RServe - Install

Setup in R:

Once installed, we can start the connection in R console by running the following code

library(RServe) (then) Rserve()



then we can just leave there and head to Tableau.

Connect in Tableau:

Either in the data source view or worksheet view, go to the toolbar

Help - Manage ... Connection ...

Select R

Save after type in the Hostname and Port

Feel free to Test Connection, this should finish setup the connection to R and ready to be used.

Make sure always start RServe first in R, before attempt to call SCRIPT_* function in Tableau.


R has a lot package to support many much more advanced calculations, but the GUI in Tableau is not the kindest. By type the code within  " ", there is no way of coding mistakes or even spellings, which will make it almost impossible to setup complicated code chunks.

For full set of statistical analysis, it is probably better to perform within R, then output the relevant results to Tableau for visualizations. RShiny is developing, but it is nowhere close to Tableau in building an interactive dashboard.

And R is built for doing statistics, anything to do with server or database will probably be more complicated to do so than Tableau Server.

Looking forward to see Tableau's integration with Einstein Discovery.

Keep following the blog for future updates.

Tue 14 Dec 2021

Sun 03 Oct 2021

Tue 28 Sep 2021

© 2022 The Information Lab Ltd. All rights reserved.