Tableau and R: FAQ

advertisement
Tableau and R: FAQ
2
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.
2.
3.
4.
5.
6.
7.
8.
Can we use precompiled packages, models, and other things with Tableau and R?
When integrating Tableau and R, what is the best practice for debugging R scripts or discovering errors?
Can you use R to reshape data?
Can Tableau pass data from a relational database to R?
Can you dynamically pass various levels of drill-down
dimensions to an R function?
How do you run a function with a mix of variable types?
Can you insert R images and graphics into Tableau?
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?
3
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.
4
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.
6.
Q: How do you run a function with a mix of variable types?
A: Tableau can send R mixed types of data. In SCRIPT_X, the X represents the
variable type that is returned to Tableau. In most cases, the one column returned
to Tableau will contain a single variable type. If there are mixed types (e.g. mixed
number and text values), it can be returned as a string using SCRIPT_STR.
7.
Q: Can you insert R images and graphics into Tableau?
A: You can output R images into Tableau dashboards as image objects, as well as
point to R images through URL objects.
8.
Q: What is the best practice for R Integration with Tableau that
R models can be reused within the same session?
A: See this getting started whitepaper about Rserve. It provides more details
about saved sessions, and the difference between Windows and Linux
installations of Rserve in private vs. shared environments.
5
9.
Q: Does Tableau Reader integrate with R?
A : At this time, you will need Tableau Desktop or Tableau Server to view a
Tableau workbook with R scripts.
10.
Q: Are there future plans for deeper integration with R?
A: We are always listening to customer ideas and would love to hear what deeper
integration you would like to see. Please submit a post to our Ideas Forum.
Download