Since SCRIPT functions are table calculations, all measures within the formula must be passed as aggregates. If the calculation is occurring at the row-level of the data, you can use ATTR() to aggregate the measure for the purposes of the calculation.
Hope that helps! Would love to hear back!
Thank you for the answer. I am having a hard time figuring out what I need to do here. As I understand it, there is no way to perform this type of test as R does it - by taking in 2 vectors, calculating a mean, standard deviation, etc., then producing a p-value.
Would I have to calculate the various inputs above in Tableau and create a custom function in R to give the p-value? (this is more complex than I'd like this process to be). The issue with trying to do everything in Tableau is that it's not possible to reference a t-distribution, as you can in Excel with TINV(confidence level, degrees of freedom) to attain a critical value for comparison.
If there is some workaround in Tableau to pass a vector into R, I would love to learn the trick.
To be very honest, I'm not very familiar with R, and my stats knowledge is limited, however the following blog post by Bora Beran contains a workbook that demonstrates using R to perform a t-test and calculate an R value:
Downloading the workbook and playing with it might get you started in the right direction. Good luck!