# Statistical testing in Tableau with R

Tableau 8.1 just got released! As I wrote before, one of the exciting new features in this release is R integration. Now you can write R scripts inside Tableau calculated fields which opens the door to many new analysis scenarios. To celebrate the release of Tableau 8.1, I put together two new examples to show how you can run different statistical tests inside Tableau.

I took advantage of Tableau parameters to provide an easy way to change the options for the Student’s t-test. Chi-square demo is based on the sample Superstore dataset. For t-test I made up some data for demonstrative purposes. Now that these are done, should I also create a logistic regression example? Or given the positive feedback and interest we saw at R User Groups, I wonder if somebody else will do it before me.

Standard

## 16 thoughts on “Statistical testing in Tableau with R”

1. Juan LP says:

Thank you. This is a very beautiful post for a Tableau beginner like myself 🙂

2. Riley says:

Hi Bora!

Those were extremely well done! Good job and thanks for doing them! They help a lot for someone like me who is trying to learn how to integrate R in Tableau.

I do have one question I was hoping you might be able to answer/provide some guidance on. How would you be able to conduct an ANOVA in Tableau using R? I know how to do this in R, but am having trouble performing this in Tableau with R.

Thanks!

3. Mehdi says:

Thank you and well done

4. Pam says:

Hi
I was wondering if the link to the workbook still existed or had been moved? I’m trying to do some R/Tableau integration and would love to have a look at your workbook.
Cheers

5. Li Yezhou says:

Hi, I wonder if you have upgraded to Tableau 9? Because it says the calculated field is no longer valid.

(I have downloaded only the StatisticalTestWithRandTablue.twbx and running Excel 2013 on Mac)

6. paolotta87 says:

hi, I tried with my data but I have this error: Error in data.frame(…, check.names = FALSE) : arguments imply differing number of rows: 6, 5 could you please help me understand why? thanks a lot.

• Can you check if you have NULLs in your data?

7. sarita says:

hi bora,
i am trying to execute the R query in tableau it showing error such as:-
Error in base::parse(text = .cmd) : :5:0: unexpected end of input 3: sqlQuery(dbhandle,’update dummy_table set Parameter_Value =.arg1 4: where Last_Update_By=custadmin’ ^

This is my query :
SCRIPT_STR(“library(RODBC);Library(RSERVER);
dbhandle=odbcConnect(CDWODBC);
sqlQuery(dbhandle,’update dummy_table set Parameter_Value =.arg1
‘July’
)

• You start with ’ and end with ‘ . Try to match the quotes and see if it fixes it.

• sarita says:

NO,It’s not working . Still i am facing same problem ..

8. Salman says:

Hi – What’s the purpose of filter one ‘One’ in chi-square test. I saw it’s calling Index.

• The test returns the p-value and Tableau joins it to the main Tableau, replicating it. So if you have 10 rows, you will see the same value repeating 10 times. One filter hides all rows except the first one since you really only need to see the p-value once.

9. Heather S says:

Hi! Awesome workbook – I tried to open it but I consistently get this error:
Error in eval(expr, envir, enclos) : could not find function “t.test”

Any idea as to why that is? I get the same error when I try to open a workbook with my own data and use the prop.test function