You are on page 1of 3

Quick Reference Guide

Execute TERR Functions within Spotfire Expressions


Descriptions of TERR Functions and Spotfire Expressions
The computational functionality of TIBCO Spotfire can be enhanced through the use of the local TIBCO Enterprise Runtime for R, or TERR,
statistical engine. Although TERR functionality may be implemented through the use of Spotfire Data Functions, the focus of this topic
will be the implementation of TERR functionality within Spotfire Expressions.

Analysis document

Script/input
What is TERR?
TIBCO Enterprise Runtime for R (TERR) is an
enterprise-grade analytic engine that TIBCO has
built from the ground up to be fully compatible
with the R language

output

TERR allows users to develop code in open


source R, then integrate and deploy their R code
on a commercially-supported and robust
platformwithout the need to rewrite code.

Spotfire Client

Spotfire Expressions may be applied to perform calculations


on the underlying data table which:

There are two options for implementing TERR functionality within


Spotfire Expressions:

result in new data columns

Option #1 use existing TERR Statistical functions

configure data for display in visualizations


Option #2 create new Expression Functions

manipulate data as part of a data table transformation

These options are discussed further on the pages which follow.

learn.spotfire.tibco.com

Page -1-

TIBCO Software Inc.

Quick Reference Guide

Execute TERR Functions within Spotfire Expressions


Use Existing TERR Statistical Functions
Option #1 Within the various expression dialogs (Calculated Column, Custom Expression, Edit expressions on expanded selectors, etc.)
you can use existing TERR functions which are organized within the Statistical functions category.
The TERR functions will insert a default script (in pink), ...
TERR_Real( "output <- input1" , )
... and you can edit that script to perform the desired calculations ...
TERR_Real( "output <- input1 + input2 ... inputN" , Arg , Arg , ... Arg)
... and add arguments (which may be fixed values, columns,
properties, or the results of other functions) to serve as input
variables ...
TERR_Real( "output <- input1 * input2" ,
[USD] , DocumentProperty(EURexchange) )

Your script may contain


multiple input variables ...

Search for terr to locate


these functions, and select
the function which
represents the data type for
the expected output from
your TERR script.

learn.spotfire.tibco.com

(input1, input2, ... inputN)

... but may result in only one


output variable: (output)

Page -2-

TIBCO Software Inc.

Quick Reference Guide

Execute TERR Functions within Spotfire Expressions


Create New Expression Functions
Option #2 Because more complex scripts can be cumbersome to implement
within existing TERR functions, you may create your own Expression Function
which will contain the required script.

1. Create your function:


Edit > Data Function Properties
- Expression Functions tab
a. Provide Name and Description
b. Select Category and Return type
(output data type)
c. Enter TERR Script

2. Apply your function:


a. Insert your function within
any of the expression dialogs
b. Add an argument for each
input variable

learn.spotfire.tibco.com

Page -3-

TIBCO Software Inc.

You might also like