Marcia Hon 2 Posted January 4, 2019 Share Posted January 4, 2019 Hello, I would like to run R code in Spotfire. An example is: # Define the cars vector with 5 values cars Link to comment Share on other sites More sharing options...
Kathleen Roan Posted January 4, 2019 Share Posted January 4, 2019 Hi, Marcia. To use the R engine with Spotfire, you must have TIBCO Spotfire Statistics Services (TSSS), and you must configure it with the R engine. Then you can configure Spotfire to use TSSS. See https://docs.tibco.com/products/tibco-spotfire-statistics-services for documentation.) Alternatively, you can use the TERR engine, which is included with Spotfire, to create a data function or an expression function. (TERR is largely compatible with R.) See the TERR documentation at https://docs.tibco.com/products/tibco-enterprise-runtime-for-r for more information. Link to comment Share on other sites More sharing options...
Marcia Hon 2 Posted January 4, 2019 Author Share Posted January 4, 2019 Hello, Thank you for your comment. Please could you let me know the difference between TERR and TSSS Are they both available for free as part of the license They both run R, so I donot understand the differences. Thanks, Marcia Link to comment Share on other sites More sharing options...
Gaia Paolini Posted January 4, 2019 Share Posted January 4, 2019 Hi Marcia TERR is a language interpreter that runs code written with the same syntax as R code. So you can develop your script e.g. in RStudio then copy and paste it into Spotfire. You can think of TERR as an alternative to R, developed for efficiency and enterprise scalability. TSSS is effectively a server layer where TERR or R or other statistical languages can run. If you have Spotfire Analyst you can run TERR locally within your Spotfire file, and you dont need the TSSS. There are also intro videos on You Tube (search for e.g. TERR Spotfire). An interesting intro which shows a step-by-step example is here:https://www.youtube.com/watchv=gSkTKYrhAls This is a vast topic. There is a lot of material out there. In order to run (TER)R within Spotfire you create what is called a Data Function, which is a script. The Data Function can be run by defining a button in a text area, and point it to the code. A Data Function within Spotfire can have several inputs and outputs. I am attaching a very basic example of generating a linear regression in a Spotfire dxp and outputting and plotting the residuals. You can obviously do a lot more using R libraries, and you can add sophisticationparametrising your Data Function. As in this example you can get the Data Function to react to filtering, or alternatively to marking, or execute automatically when data refreshes. It is the interplay between running the code and viewing the results that makes it a great way to do analytics interactively. However note that TERR does not generate graphics directly (you cannot run plot for instance). What you normally do it output the data you created, and then use it to create a Spotfire plot. There are alternatives to bring in native R plots (a TERR library called RinR). There are several examples of more complex TERR Data Functions downloadable from the TIBCO Community. For instance, here:https://community.spotfire.com/search/site_area/Exchange/product/541/tags/d... Gaia Link to comment Share on other sites More sharing options...
Kathleen Roan Posted January 4, 2019 Share Posted January 4, 2019 Great example and great explanation. Thanks, Gaia. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now