Spotfire® Enterprise Runtime for R

Debugging a Simple Data Function

Create a simple data function and then examine the debugging output in Spotfire Analyst.

About this task

Create this example using any sample data set in Spotfire Analyst. The example described in this topic uses the geyser data set from the Sdatasets package in TERR.

Before you begin

  • You must have the advanced analytics license to use the TERR toolset. If you do not have this license, see your Spotfire administrator.
  • You must have Enabling Debugging for Data Functions.

Procedure

  1. Open a data set in Spotfire Analyst.
    This example uses the TERR dataset Sdatasets::geyser. Follow the instructions in Importing TERR Data Sets Using a Data Function. Alternatively, you can use any data set.
  2. Register a data function.
    This example shows a simple data function that assigns one table to another table.
    1. In the Name text box, provide a meaningful name, such as Debug Testing.
    2. In the Script tab, write a simple script to assign the existing table to a new table.
      
      # This data function assigns the table y to the object x to create a new table.
      x <- y
    3. On the Input Parameters tab, add the input parameter (in the example above, y) as a table, and allow all data types.
    4. On the Output Parameters tab, add the output parameter (in the example above, x) as a table.
    5. Click OK, and then click Run.
      The Edit Parameters dialog box is displayed.
    6. In the Edit Parameters dialog box, for the Input parameter y, specify the Input handler as an Expression.
    7. In the Expression text box, provide an expression.
      The example uses the following Spotfire expression, which uses property calls to create the new visualization. (See the topic "Properties in Expressions" in the Spotfire Help for property calls if you want more information on the property calls $map, $esc, and $csearch.)
      $map("[geyser].$esc($csearch([geyser],"*"))",",")
    8. Click OK to run the data function.
      You should see the yellow notification triangle indicating that the data function ran and the results are in the debugger.
    9. Open the Notifications dialog box and review the debugging output.

      simple data function debugging output

    10. Clear the debugger, and then close the Notifications dialog box.

What to do next

Try writing a cat statement in the data function.