This seems really simple but for some reason it doent work;
here is the R script;
x <- c(-50, -25, -12, 0, 12, 25, 50)
y <- c(1,2,3,4,5,6,7)
z<- approx(x,y, 5)
z[2]
output;
$y
[1] 4.416667
using Tableau -
SCRIPT_REAl(
' approx(.arg1,.arg2,.arg3)',
sum([Shock]),
sum([Value]),
5)
returns;
The results returned by the SCRIPT function is of an unexpected type.
the data is a two tabled column with 7 rows....Shock and Value. Any thoughts?
Hi Douglas,
May be something like this:
SCRIPT_REAL(
"
z <- approx(.arg1,.arg2,.arg3)
z$y
",
SUM([Shock]),
SUM([Value]),
5
)
Please find the attached (version 10.2).
Yours,
Yuri
Become a Viz Whiz on the Forums!
Support the Community and master Tableau.