Details on Register Data Functions


The Register Data Functions dialog is used to configure data functions that allow you to add calculations written in R (or other languages) to your analysis. The data function is executed using a statistical engine such as the TIBCO Enterprise Runtime for R engine, using TIBCO Spotfire Statistics Services.

If you have access to the corresponding software, you can also use open-source R, SASĀ®, or MATLABĀ® scripts when registering data functions. See the TIBCO Spotfire Statistics Services - Installation and Administration Guide for information on how to connect to these engines.

The Register Data Functions dialog also allows you to specify which predefined functions in your package repository should be available for end users of TIBCO Spotfire. Once a function has been registered and saved to the library it can be used in any analysis, also by other users than the script author.

To reach the Register Data Functions dialog:

  1. On the menu bar, select Tools > Register data functions.

Option

Description

New Function

Clears all text fields and list views in the dialog so you can start defining a new data function.

Open

Opens a previously saved data function from the library for further configuration.

Import

Imports script function definitions that you have earlier exported to disk or created using other script editing tools.

Save

Saves an edited data function to the library.

Save As

Opens the Save as Library Item dialog where you can specify a name and a location in the library where you want the data function to be saved.

Export

Saves a script function definition to disk so that it can be shared or further edited in other script editing environments.

Run

Opens the Edit Parameters dialog so that you can specify settings for the input and output parameters and execute the current data function. This is mostly meant as a shortcut for testing the data function before it is saved to the library. Run the saved data function using Data > Data function properties before saving the analysis in order to be able to synchronize the data function with any updates in the library in the future. See also Document Properties - Data Functions.

Name

Displays the name of the data function when it has been saved to the library. If the function has not yet been saved, this field will be empty.

Type

Selects the type of function to use. The available types depend on which calculation engine you have access to. For predefined functions, select open-source R function or S-PLUS function.

When a function that you want to use from within TIBCO Spotfire has been defined and saved to your package repository in Spotfire Statistics Services, you need to write down or remember its name, together with the names of all required input and output parameters

To define a new script, select R script - Open Source R, R script - TIBCO Enterprise Runtime for R, S-PLUS script, SAS script or MATLAB script.

Packages

[Available for R scripts run in TIBCO Enterprise Runtime for R, open-source R functions and scripts and S-PLUS functions and scripts; not available for SAS or MATLAB scripts.]

Optional. Specifies any packages to be used by your current data function.

For example, if you want to create a data function based on a predefined statistical R function, provide the name of the package and optionally download it from CRAN. Type the exact name of the package where the function is located in the Spotfire Statistics Services package repository. (This is only necessary if there is more than one function bearing the same name in the repository, or the packages are not loaded automatically.)

If more than one package is required, separate the package names with semicolons.

Function name

[Available for open-source R and S-PLUS functions only, not for scripts.]

Specifies the function name. Type the exact name of the function of interest, as it was defined in the Spotfire Statistics Services package repository.

Description

Optional but recommended. A description of the data function. This description is stored in the library and can help the end users of the data function to select the proper function.

Allow caching

Specifies that calculations are reused if the same subset of input values has been calculated before.

Clear this check box if some of the input data comes from somewhere else than your current analysis and you want a new calculation from Spotfire Statistics Services each time input data changes (even for changes into something that has already been computed before). Input data can change when the input depends on filtered values, marked values, or a property value.

For example, if the data function includes a random number generator, you probably do not want to cache a previously generated random number. Instead, calculate a new random number for each refresh of the data function. Another example where you would clear the check box is if the data function includes the current date or time.

Script tab

[Available for script type data functions only, not for data functions based on predefined statistical functions.]

Type or paste a script in the specified script type language.

Note: If you are developing scripts using open-source R or 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.; however, you can configure RStudio for the TIBCO Enterprise Runtime for R engine and to view 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.

You can change the font settings for the script tab using Tools > Options, Fonts and selecting Expression and script editor.

The Script editor provides syntax highlighting and automatic indenting to make writing and reading scripts easier. The colors are not configurable in this release; however, they have been set to closely match Notepad++, a popular text editing tool.

Input Parameters tab

Option

Description

Parameters

Lists all input parameters that have been mapped using the Input Parameter dialog.

Add

Opens the Input Parameter dialog.

Edit

Opens the Input Parameter dialog with the selected input parameter and its current settings available for editing.

Remove

Removes the selected input parameter from the list.

Move Up

Moves the selected input parameter up one step. The order of the input parameters in this list determines the order in which the input parameters should be retrieved.

Move Down

Moves the selected input parameter down one step.

Output Parameters tab

Option

Description

Parameters

Lists all output parameters that have been mapped using the Output Parameter dialog.

Add

Opens the Output Parameter dialog.

Edit

Opens the Output Parameter dialog with the selected output parameter and its current settings available for editing.

Remove

Removes the selected output parameter from the list.

Move Up

Moves the selected output parameter up one step. Use this button to place the most important output parameters at the top of the list.

Move Down

Moves the selected output parameter down one step.

See also:

What are Data Functions?

How to Use Data Functions

Script and Data Function Trust