1 Reply Latest reply on Sep 2, 2016 2:36 PM by Patrick Van Der Hyde

    Tableau not returning results from R script

    Thashen Padayachy

      Good morning,


      I am new to using Tableau and R.

      I am trying to call a R script within Tableau that returns a set of results.


      My R script has a function called lessThanFn, that returns results from a column of data that are less than a specified number. In this particular case, I am wanting to return all Credit amounts that are less than 700.

      However, when I drag and drop the calculated field in Tableau I receive an error message saying "the result returned by the SCRIPT function is of an unexpected type".


      Below is my R code and the code used in Tableau to call the R script.

      Thank you in advance for any help!


      R code:

      lessThanFn <- function(x,y)


        for(i in 1:length(x))









      Tableau code to call R script:




      result <- lessThanFn(.arg1,.arg2)',ATTR([Credit]), ATTR(700))