How to make developing TERR in Spotfire less painful
In a previous article I mentioned using RStudio as a development environment for Spotfire TERR (TIBCO Enterprise Runtime for R).
For those of you using Spotfire and not using TERR, it’s an incredibly powerful feature you really need to add to your toolbox. It effectively gives you the ability to use every type of analytical function and data manipulation process ever developed. From Latent Factor Clustering to scripted ETL – it pretty much does it all. However, trying to develop code inside the Spotfire TERR console can be a bit of a pain.
Why? Because you have to click through three menus to execute the code, then if there is an error, you have to parse through Spotfire and TERR’s errors to find the cause.
Therefore, it makes sense to develop in an IDE (such as RStudio) then copy paste your code into Spotfire.
“But RStudio uses R not TERR, so you can’t do that!” Actually, you can! But it requires a few not so obvious steps. Let me show you how:
Step One: Download RStudio
If you don’t have it already, RStudio is the best development environment for R, so you should get it even if you’re not using TERR. (Why are you reading this article by the way?)
Plus the Open Source version is completely free so you have no excuse. Get it here.
There’s a whole bunch of little configuration tricks we can discuss, but that’s for another article.
Step Two: Show hidden folders
Spotfire by default hides the folder containing the TERR engine, so to find it, you have to make it stop hiding. To accomplish that you have to “Show Hidden Folders.”
Step Three: Find your TERR Engine
Now assuming you have successfully installed RStudio and you have Spotfire installed on your local machine (Again, why are you reading this if you don’t have Spotfire?) you can locate the application Spotfire uses to process R code – The TIBCO Enterprise Runtime for R engine.
It is typically located in C:\Program Files (x86)\TIBCO\Spotfire\[SPOTFIRE VERSION]\Modules\TIBCO Enterprise Runtime for R_[TERR VERSION]\engine\bin
With [SPOTFIRE VERSION] as the version of Spotfire installed on your computer and [TERR VERSION] the TERR version you are currently running.
If you can find the directory …\TIBCO\Spotfire\[SPOTFIRE VERSION]\ but you can’t find “Modules” That directory is still hidden, stop skipping steps, go back to step number two and try again.
Step Four: Point RStudio to your TERR Engine
RStudio defaults to a local instance of R. You probably installed it when you installed RStudio. But we need to point RStudio to TERR not R.
We verified the location of TERR in step three, so now we need to tell RStudio where to find TERR.
1. In RStudio go to Tools > Global Options…
Step Five: Verify TERR is running in RStudio
When RStudio restarts, take a look at the console. It will tell you what version of R, or in this case TERR, is running. If you see “TIBCO Enterprise Runtime for R..” then you are successfully running TERR in RStudio! Yay!
Learn even more about TERR by getting our latest Ebook!