Spotfire® Enterprise Runtime for R

Importing TERR Data Sets Using a Data Function

Several sample data sets are included in this help as HTML tables that you can copy and paste into Spotfire, but you can also write a data function to import data sets available in the TERR library Sdatasets.

About this task

Perform this task in Spotfire if you need sample data to model. You can find descriptions of the data sets in the Sdataset package included with TERR, and embedded in Spotfire. See Getting Help with Spotfire Enterprise Runtime for R.

Before you begin

You must have a license for advanced analytics in Spotfire. If you do not have access to the data function dialog box, see your Spotfire administrator.

Procedure

  1. From the menu, click Tools > Register Data Functions .
  2. In the Register Data Functions dialog box, provide a name and a description.
    If you are working through the example, provide the following.
    OptionDescription
    Name air
    Description Observations (rows) on four variables (columns), taken from an environmental study that measured ozone, solar radiation, temperature, and wind speed for 5 months in 1973 in the New York City area.
  3. In the Register Data Functions dialog box, in the Script tab, type the data function to import the data from the library.
    The name includes the name of the data object to create, the assignment operator, and the data set (including the library name) to import, in the form library::data. If you are working through the example, type the following.
    airdata <- Sdatasets::air
  4. Click the Output Parameters tab, and then click Add.
    The Output Parameter dialog box is displayed.
  5. Provide the output name, and from the Type drop-down list box, select Table.
  6. Click OK, and then in the Register Data Functions dialog box, click Run to run the data function.
    The Edit Parameters is displayed.
  7. In the Edit Parameters dialog box, click the Output tab, and for the Output handler, select Data table.
  8. Click OK to create the data table, and then in the Register Data Functions dialog box, click close.
    You are prompted to save the data function to the library. Click Yes to save it to the library, or click No to close without saving it.

Results

The data panel displays the column names, and the data is ready to use.