1 Reply Latest reply on Jul 7, 2016 4:16 AM by Chris Dickson

    Error with R Script in Tableau

    Sandeep Kotha

      Hi All,

       

      I am new to this community. I am running the R Programming script in tableau and I got the error shown in the below screenshot.

      I did the below before I run the script in tableau.

       

      library(Rserve)

      Rserve()

      Help ->Settings and Performance-> Manage R connection -> In Rserve connection window : server=localhost  Port: 6311

       

      I got the message saying "Successfully connected to the  Rserve service".

      Then I created the field called "R Cluster"  with the below code:

       

      SCRIPT_INT('

      result <- kmeans(x = data.frame(.arg1,.arg2,.arg3,.arg4), 3);

      result$cluster',

      SUM([Sepal.Length]),SUM([Sepal.Width]),SUM([Petal.Length]),SUM([Petal.Width])

      )

       

      I got the error shown in the below screenshot. Please suggest me how to resolve this error.

       

       

      Thank you,

      Sandeep

        • 1. Re: Error with R Script in Tableau
          Chris Dickson

          Hi Sandeep,

           

          are you using the standard Sepal dataset in R to learn R for tableau? The issue you are having is in the arguments you have passed the clustering calculation in R, meaning you are asking for more clusters than there are points, this is because it is a table calculation so is aggregating the values sent to R.

           

          Try unticking 'Aggregate Measures' in the Analysis menu.