Inspiration
Need a dashboard that clients can perform any combination of two-sample for a t-test of group differences. Thus, Tableau developers can be relieved from writing too many R scripts for all possible pairs of two-group combinations that clients may be interested in.
What it does
- Dynamically conducts a two-sample t-test for whichever two groups are selected.
- Displays a customized & friendly, instead of the default, error message when the user fails to pick exactly two groups for the t-test.
- Changeable alpha level for the hypothesis testing.
How we built it
Tableau, R, and Rserve
Challenges we ran into
A. Displaying the friendly error message took me a while to figure it out.
The hack is to use the if-else express in the R script to check how many distinct groups have been received. If the group count is not equal to 2, return a -9 error code back to Tableau; otherwise, conduct the t-test and return the p-value.
if ( length(table(.arg2)) != 2){ -9 } else { ttest <- t.test(.arg1 ~ .arg2, paired = FALSE, alternative="two.sided") ttest[["p.value"]] }
B. Get exactly whichever two groups of the selection to be sent into the Rserve for calculation.
When a user does select exactly two groups for the t-test. Use
{FIXED : MIN([Group Name])}
{FIXED : MAX([Group Name])}
to identify the two groups. This method works fine when users selected more than two groups too. So, it can prevent some errors when doing the R analytics.
C. The Rserve response speed is not satisfactory.
I have tried to write as few as possible R code.
Accomplishments that we're proud of
- Using only a few lines of R script (including error prevention), for all possible pairs of two-group combinations.
- Being able to display a friendly message to inform the user to select two groups only.
What we learned
- More sophisticated Tableau Analytics can be make ready for and be utilized easily by our clients.
- Since Tableau doesn't have a try and catch capability, developers need to implement the script to prevent the dashboard from displaying unfriendly messages when analytics running into errors.
What's next for Tableau Analytics: Dynamic Two-Sample t-Test
Performance speed needs to be improved.
Log in or sign up for Devpost to join the conversation.