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?