Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in BI by (17.6k points)
edited by

I am currently trying to do a Spearman's Rank Correlation in Tableau using the new R capability. I was able to get the correct code in R, but having trouble putting it in a form for Tableau to understand.

My data is grouped by code. So it is a Group Correlation. My code in R:

library (plyr)

ddply(mydata,"Code",summarise, corr=cor(Survey.1,Survey.2, method="spearman"))

How do I use the Script_Real in Tableau to give me that correlation? 

1 Answer

0 votes
by (47.2k points)
  • Implement this code below

Script_Real("cor(.arg1,.arg2, method='spearman')",SUM([x]), Sum([y])).

  • Note: You need to have ID:1,2,3,4,5,6,7 near your data in order for it to run the test. Then click the pill and compute using that ID code.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Jul 23, 2019 in BI by Vaibhav Ameta (17.6k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.6k users

Browse Categories

...