2

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
  • I don't have access to Tableau to test, but this article seems to explicitly address calculation correlation in R using Tableau. Commented May 30, 2014 at 20:43

2 Answers 2

3

For those wanting to understand the coding. I have figured it out!

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Could you explain what does method=spearman do ? is it required?
1

One step you need is to configure the connection to R. See the help menu ->Settings and Performance > Manage R Connection

If you are using Tableau server, that will need to know the connection path to RServe as well. See the online help.

1 Comment

Hey Alex, The problem isnt the connection. It is the actual code being put into Tableau for that system to understand the R code. I am not sure the mechanics of the code. There are many videos on forecasting, but none on correlation. That is where my problem lies.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.