Saturday, 31 March 2018

Programming R within Tableau

In continuation of my earlier post on Integrating R with Tableau, now I need to explore how to program R within Tableau. 

R script needs to be used as a Table Calculation,  


and needs to be used as one of the 4 functions,
  1. SCRIPT_BOOL
  2. SCRIPT_INT
  3. SCRIPT_REAL
  4. SCRIPT_STR

Let me take a simple sample case to explain the same, I am using using_r_within_tableau.twbx downloaded from Tableau site for demonstration purpose.

Using the 0. 5 plus 7 as a data source. It has got 3 predefined measured, where 'Five' and 'Seven' holds value 5 and 7 respectively.


The 3rd measure 'R script for 5 + 7' adds up 'Five' and 'Seven' using R script. As I am adding 2 integers, I am using SCRIPT_INT. MIN aggregation is used on 'Five' and 'Seven' for Table Calculation, it could have been MAX or anything else also.


I initiate Rserve.

When I put these 3 measures, they add up and show correct result.


Further details and the sample Tableau file can be obtained from Tableau tutorial site.

Before I finish, I would like to draw a comparison between Power BI and Tableau with respect to using R. Power BI gives us the flexibility of using R charts (like ggplot etc) through R Visual, whereas in Tableau we get Integer / Real / Boolean / String values through Table Calculations.

In my personal opinion, I find Power BI more suitable for integrating with R.

2 comments:

  1. I think this is a very interesting blog post about Tableau and hence there is a need to provide some more information about Tableau.

    Tableau Soap Connection

    ReplyDelete
  2. Thank you for sharing wonderful information with us to get some idea about it.

    tableau online training

    ReplyDelete

Implementing & Testing Row Level Security in Power BI

I have suffered a great deal of pain while implementing and more so while validating Row Level Security in Power BI. Let me try to capture a...