5 Replies Latest reply on Jul 26, 2015 5:47 PM by THIAM TAN

# Integrating Tableau and R for data analytics in four simple steps

Following the steps from this link

http://www.simafore.com/blog/bid/120209/Integrating-Tableau-and-R-for-data-analytics-in-four-simple-steps

which I have successfully done Rserve() in RStudio, and connection is successful in Tableau.

I encounter problem when Create Calculated Field.

See errors below:

• ###### 1. Re: Integrating Tableau and R for data analytics in four simple steps
1 of 1 people found this helpful
• ###### 2. Re: Integrating Tableau and R for data analytics in four simple steps

You need to first create a parameter called Measure 1 Selector with the values Algae, BOD, Length, ...

You can create a parameter similar to how you create a calculated field. Right-click in the left-had, data pane and Create > Parameter....

There's a full description the technique here:

Swapping Measures Using Parameters | Tableau Software

• ###### 3. Re: Integrating Tableau and R for data analytics in four simple steps

I have the plot as seen below. For each of Measure 1 [e.g Length] and Measure 2 [e.g Speed], I have only ONE bubble.

there are so many bubbles for Selector 1= Algae and Selector2=Length.

So, am I correct with one bubble?

• ###### 4. Re: Integrating Tableau and R for data analytics in four simple steps

Hi Thiam,

You've probably figured this out, but the reason you're getting just one circle is that you're aggregating over all rows in the data source. By dragging Measure 1 and 2 to the rows and column shelf, you're plotting SUM(Algae) and SUM(BOD) for all data points.

Tableau aggregates by default and to see more granular data you need to add this granularity to the view.

For example, if you want to see the Algae  vs BOD for each sample, drag the dimension Sample to the Detail button on the Marks card just left of the graph. Now Tableau will calculate SUM(Algae) and SUM(BOD) for each sample. Since the data is, I assume, at the sample level, you're getting the individual values SUM(Algea) == Algae.

Also note that R scripts are Tableau "table calculations," which means they can be aggregated at a different level of detail than the regular aggregation in the view. Since you want the correlation over all samples, you should click the Correlation pill in the view and set Compute Using to Sample.

Finally, as you'll see elsewhere on the forum, it's helpful to post a packaged workbook (twbx extension) with your question so that people can better see what the issue is and post a working solution back in the reply. You can attach items to the message by clicking the "Advanced editor and add an attachment" text in the upper right.

Jim

1 of 1 people found this helpful
• ###### 5. Re: Integrating Tableau and R for data analytics in four simple steps

thanks Jim for your clear explanation. I am much clearer now. I have a lot to learn from Tableau, and it is very interesting to integrate with R.