Details on Register Data Functions


The Register Data Functions dialog is used to set up data functions that will allow you to add calculations written in S-PLUS or open-source R to your analysis, which then runs in an S-PLUS engine, or in an R engine or a TIBCO Enterprise Runtime for R engine, respectively. If you have access to the corresponding software, you can also use 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 different engines.

The Register Data Functions dialog also allows you to specify which S-PLUS or open-source R functions in your Spotfire Statistics Services package repository should be available for end users of TIBCO Spotfire. Once a function has been registered, it is available from the library and can be used in any analysis.

  1. Select Tools > Register Data Functions....

df_register_data_functions_d.png

Option

Description

New Function

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

Open

Allows you to open a previously saved data function from the library for further configuration.

Import

Allows you to import script function definitions which 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

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

Run

Opens the Data Functions - 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 Tools > Data Function...  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

Allows you to select what type of function to use. The types available will depend on which calculation engine you have access to. For predefined functions, select S-PLUS function or open-source R function. To define a new script, select S-PLUS script, R script - Open Source R, R script - TIBCO Enterprise Runtime for R, SAS script or MATLAB script.

Packages

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

Optional. Allows you to specify any packages in the Spotfire Statistics Services package repository that are being used by your current data function.

For example, if you want to create a data function based on a predefined statistical S-PLUS function, you need to provide the name of the package in the S-PLUS repository where this function is located (e.g., stat).

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

Function name

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

This is where you type the function name as it has been defined in Spotfire Statistics Services.

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

Select this check box to allow calculations to be 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 are changed (even for changes into something that has already been computed before). Input data are often changed when the input is depending on filtered values, marked values or a property value.

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

Script tab

Available only for script type data functions. To change to a script type data function, click on the Type drop-down list above and select S-PLUS script, or R script - TIBCO Enterprise Runtime for R, or R script - Open Source R.

df_script_tab.png

Here you can type or paste any 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.

The font settings for the script tab can be changed using Tools > Options, Fonts page and selecting Expression and script editor.

Input Parameters tab

df_input_parameters_tab.png

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

df_output_parameters_tab.png

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