2

Recently tableau gave the functionality of R connection in their release 8.1. I want to know if there is any way i can call an entire table created in R to tableau. Or an .rds object which contains the dataset into Tableau?

Bflat
  • 47
  • 1
  • 10

3 Answers3

2

There is a tutorial on the Tableau website for this and a blog on r-bloggers which discuss. The tutorial has a number of comments and one of them (in early Dec I think) asks how to get an rds file in. You need to start Rserve and then execute a script on it to get your data.

Sorry I can't be more help as I only looked into it briefly and put it on the back-burner but if you get stuck they seem to come back quickly if you post a comment on the page:

http://www.tableausoftware.com/about/blog/2013/10/tableau-81-and-r-25327

Matt Weller
  • 2,684
  • 2
  • 21
  • 30
  • I saw it already. Thanks for trying to help. But the business problem i am facing is very screwed up, not statement wise but the tools(tableau etc.) – Bflat Jan 09 '14 at 13:50
  • 2
    Maybe if you outline what is causing you difficulties then somebody will provide a better answer. The functionality in Tableau is very new and there is little in the way of useful documentation but I'd have thought that by now some developers would have solved your problem. Do the organisation have technical support from Tableau? – Matt Weller Jan 09 '14 at 14:04
  • Yep i saw a webinar on it, but it didn't help much. I understand that the functionality is just 2 months old. I how they get better on it. The cause of my difficulties was my boss, he wanted me to run whole PheWAS in tableau by exploiting R. When I could well do it in R and visualize the results later in Tableau. But... bosses are stupid and absurd. I handled it anyways. thanks. – Bflat Jan 09 '14 at 14:14
2

Just pointing out that the Tableau Data Extract API might be useful here, even if the current version of R integration doesn't yet meet your needs. (Note, that link is to the version 8.1 docs released in late 2013 - so look for the latest version to see what functionality they've added since)

If what you want to do is to manipulate data in R and then send a table of data to Tableau for visualization, you could first try the simple step of exporting the data from R as a CSV file and then visualizing that data in Tableau. I know that's not sexy, but its always good to make sure you've got a way to get the output result you need before investing time in optimizing the process.

If that gets the effect you want, but you just want to automate more of the steps, then take a look at the Tableau Data Extract API. You could use that library to generate a Tableau Data Extract instead of a CSV file. If you have something in production that needs updates, then you could presumably create a python script or JVM program to read your RDS file periodically and generate a revised extract.

Alex Blakemore
  • 11,301
  • 2
  • 26
  • 49
0

Let us assume your data.frame/ tibble etc (say dataset object) is ready in R/ RStudio and you want to connect it with Tableau

1. In RStudio (or R terminal), execute the following steps:

install.packages("Rserve")
library(Rserve)
Rserve()           ##This gets the R connection service up and running

2. Now go to Tableau (I am using 10.3.2):

Help > Settings and Performances > Manage External Service Connection

Enter localhost in the Server field and click on Test Connection.

You have now established a connection between R and Tableau.

3. Come back to RStudio. Now we need a .rdatafile that will consist of our R object(s). In this case, dataset. This is the R object that we want to use in Tableau. Enter this in the R console:

save(dataset, file="objectName.rdata")

4. Switch to Tableau now.

Connect To a File > Statistical File

Go to your working directory where the newly created objectName.rdata resides. From the drop down list of file type, select R files (*.rdata, *.rda) and select your object. This will open the object you created in R in Tableau. Alternatively, you can drag and drop your object directly to Tableau's workspace.

Saurabh Jain
  • 1,600
  • 1
  • 20
  • 30
  • Hi,I tried the same as you mentioned above. Connected using rserve. But while loading in tableau, it gives error=-1 which says - This version of RData files are not yet supported. Error reading file dataframe.rdata: error code=-1 The table "[TableauTemp].[dataframe.rdata]" does not exist. – Nitesh Jindal Jul 01 '19 at 07:21
  • Any help or advise please? – Nitesh Jindal Jul 01 '19 at 07:21
  • how to connect when you have Rserve on Linux ? – user5249203 Mar 04 '20 at 02:56