Tableau and R: FAQ


Overview | What you'll learn: 

This FAQ answers 10 common questions about Tableau's integration with R, what's possible, and best practices for using the two tools together. Questions include:

  1. Can precompiled R packages, models, and libraries be used with Tableau?
  2. When integrating Tableau and R, what is the best practice for debugging R scripts or discovering errors?
  3. Can you use R to reshape data?
  4. Can Tableau pass data from a relational database to R?
  5. Can you dynamically pass various levels of drill-down dimensions to an R function?
  6. How do you run a function with a mix of variable types?
  7. Can you insert R images and graphics into Tableau?

and more.

We've also pulled out the first several pages of the whitepaper for you to read. Download the PDF on the right to read the rest.


This document answers 10 frequently asked questions about Tableau’s integration with R. For questions about getting started, how to set up R integration and the Rserve package with Tableau Desktop and Tableau Server, please see this whitepaper and this Knowledge Base article.

You can also find additional resources, included a recorded webinar on the R Solutions page.

  1. Can we use precompiled packages, models, and other things with Tableau and R?
  2. When integrating Tableau and R, what is the best practice for debugging R scripts or discovering errors?
  3. Can you use R to reshape data?
  4. Can Tableau pass data from a relational database to R?
  5. Can you dynamically pass various levels of drill-down dimensions to an R function?
  6. How do you run a function with a mix of variable types?
  7. Can you insert R images and graphics into Tableau?
  8. What is the best practice for R Integration with Tableau that R models can be reused within the same session?
  9. Does Tableau Reader integrate with R?
  10. Are there future plans for deeper integration with R?

1.

Q: Can we use precompiled packages, models, and other things with Tableau and R?

A: Yes. The general rule is, if you can do it in R, you can easily integrate it with Tableau. This includes any statistical packages, parallel computing packages, models and libraries, whether they are standard within R or if you create them independently. This also includes commercialized versions of R, including Revolution Analytics. You can also return data frames from R one column at a time.

2.

Q: When integrating Tableau and R, what is the best practice for debugging R scripts or discovering errors?

A: There are two ways to do this. The first is to use the ‘write.csv’ command within the calculated field that calls an R script. The other, is to use the debug version of the standalone executable of Rserve (Rserve_d.exe) which will print out any code that R is performing as Tableau calls the R scripts.

3.

Q: Can you use R to reshape data?

A: Yes, see this example where R and multidimensional scaling are used to reshape 1600+ columns into Tableau.

4.

Q: Can Tableau pass data from a relational database to R?

A: Yes, Tableau can pass data from any source and run R scripts on that data, whether a flat-file, relational database, cube, or an unstructured data store.

5.

Q: Can you dynamically pass various levels of drill-down dimensions to an R function?

A: Yes, and very easily too. In Tableau, R scripts are run in table calculations and therefore can be run against various dimensions. Simply change the aggregation level of the desired dimension and compute the table calculation accordingly.

Want to read more? Download the rest of the whitepaper!

You might also be interested in...