Details on Register Data Functions


The Register Data Functions dialog is used to set up data functions that you can use 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

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 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

Selects the type of function to use. The available types 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. Specifies 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 R function, provide the name of the package that you have downloaded from a reliable package repository (such as CRAN).

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.]

Specifies the function name.

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 only for script type data functions. To change to a script type data function, click on the Type drop-down list, and then select S-PLUS script, or R script - TIBCO Enterprise Runtime for R, or R script - Open Source R.

 

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 Cloud Software Group, 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

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