0

I am sending passing R scripts to R from Tableau and would like to be able to see the result in the R console. I have got this to work in the past, but not sure how to do it again.

In R I've ran the following lines of code: Note, [Petal Length] is just a column of number values- it doesn't matter what the numbers are. In this case I just got it from the IRIS dataset (which is pre-packaged in R as you can see if you run data())

install.packages("Rserve") 
library(Rserve)
run.Rserve() 

In Tableau, the calulated field that contains the R script is:

SCRIPT_INT('print(.arg1)', SUM([Petal length]))

Thanks.

Ryan Chase
  • 2,384
  • 4
  • 24
  • 33

1 Answers1

3

After some searching I finally found the answer to this question. 1) you have to have the function print() in the Tableau calculated field, and 2) you have to use the command: run.Rserve() as opposed to Reserve().

Ryan Chase
  • 2,384
  • 4
  • 24
  • 33
  • does anybody know the difference between `run.Rserve()` and `Rserve()`? Thanks. – Ryan Chase Sep 25 '15 at 14:05
  • 1
    found the answer here: [link](https://cran.r-project.org/web/packages/Rserve/Rserve.pdf). Apparently, "the main difference between Rserve and run.Rserve is that Rserve starts a new process, whereas run.Rserve turns the current R session into Rserve." – Ryan Chase Sep 25 '15 at 14:27
  • you can accept your own answer to not leave it as unresolved – jangorecki Oct 27 '15 at 13:47