The Expression Functions dialog allows you to register a function in the Spotfire expression language that is based on TIBCO Enterprise Runtime for R. In this step-by-step instruction, we have added an example of how you type a script to create a temperature conversion function.
Note: If you are developing scripts using TIBCO Enterprise Runtime for R, we recommend that you use RStudio, a full-featured, open-source integrated development environment for working with R code. It is provided independently of TIBCO Software Inc. You can configure RStudio to use the TIBCO Enterprise Runtime for R engine and to display its language reference. Also, you can access the TIBCO Enterprise Runtime for R language reference at https://docs.tibco.com/products/tibco-enterprise-runtime-for-r.
To register an Expression Function in Spotfire:
In TIBCO Spotfire, select Edit > Data Function Properties (G)
Click on
the Expression Functions tab.
Response: The Data
Function Properties dialog is displayed.
Click New...
Response: The Expression
Function dialog is displayed.
Type a Name
for your Expression Function.
Comment: The name of the Expression Function will appear when browsing
in the function list.
Type a Description
for your
Expression Function.
Optionally: The description of the Expression Function will be displayed
when browsing the function list.
In the Script
field, type the following script to create a temperature conversion
function:
# Define the FahrenheitToCelcius function:
FahrenheitToCelcius <- function(TempCelcius)
{
TempFahrenheit <- TempCelcius * (9/5) + 32
TempFahrenheit
}
# Run the function to produce the output
output <- FahrenheitToCelcius(TempCelcius = input1)
Comment: Or simply run a built-in function from TIBCO Enterprise Runtime
for R.
Select Category in which to place the function in the function list.
Select Return type to define The Spotfire data type that the script should return
See also:
How to Edit an Expression Function