How To Develop Code Inside Spotfire TERR Using RStudio

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)TIBCOSpotfire[SPOTFIRE VERSION]ModulesTIBCO Enterprise Runtime for R_[TERR VERSION]enginebin

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 …TIBCOSpotfire[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…

2. In the General menu, click Change… to change your R version:

3. TERR Typically does not show up by default, so we’ll need to click “Browse…”

4. Navigate to the “TIBCO Enterprise Runtime for R_[TERR VERSION]engine” folder on the path to the TERR engine

5. Take your pick of either 32 or 64 bit TERR (There isn’t much difference)

6. Make sure TERR is selected in the “Choose R Installation” Window, click “OK”, and you are ready to go! (After you restart RStudio for the changes to take effect…)

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!

[maxbutton id=”8″ ]

Please follow and like us:

3 Comments

Lou Bajuk-Yorgan
on February 17, 2015 at 5:40 pm

Hi Daniel

Just wanted to let your readers know that Steps 2 & 3 will be replaced with something much easier in Spotfire 7.0, available soon. In the latest release, users can simply click on the new “TERR Tools” menu item, click “Copy TERR Engine Path to Clipboard”, and they will have the right path, ready to paste into their RStudio configuration.

Marcus,
It is likely that there is a hidden folder issue. Make sure you can see the folder “modules” in your local Spotfire directory.
Which version of Spotfire are you using? With Spotfire 7.0 you have the option to open RStudio directly from Spotfire with the TERR engine already running.
Hope this helps! Let us know if you have any other questions!