R, Visualization

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.

Statistical tests in 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.

You can download the Tableau workbook from HERE.


22 thoughts on “Statistical testing in Tableau with R

  1. 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.


  2. Pam says:

    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.

  3. 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)

  4. 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.

  5. 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 :
    sqlQuery(dbhandle,’update dummy_table set Parameter_Value =.arg1
    where Last_Update_By=custadmin'”,
    please help me to solve it soon.

    • 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.

  6. 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

  7. Birgül says:

    Hi Bora, this is a great example and I would love to download the Tableau File. Could you please put it on Tableau Public? Unfortunately I am not able to download it via yourGoogleDrive link. Thank you very much!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s