Manage R Scripts

Create an R Script

Procedure

  1. On the left navigation menu, select Tools, and then select R Scripts.
    The R Scripts page appears.

  2. Select Create New.
    The New R Script page appears, which contains the script editor.

  3. In the editor, enter your R code.
    Note: When you use R scripts with policies, the policy execution engine sends date inputs to the R script in UTC. If your R script performs any calculations based on dates, the date output must also be in UTC and use the standard date format yyyy-MM-dd hh:mm:ss.fff.
  4. Define each parameter in the R script using the Parameters pane.
  5. Select .
    The Save As window appears.

  6. In the Catalog pane, navigate to the location at which you want to save the R script.
  7. Enter values in the Name, Caption, Description, and Of type boxes.
  8. Select Save.
    The R script has been saved.

Define Parameters in R Scripts

About This Task

When you define a parameter, you are specifying whether each parameter in the R script is an input or output parameter, whether it is required, and what type of data it requires.

Procedure

  1. Access the R script for which you want to define parameters.
  2. At the bottom of the page, select Parameters.
    The Parameters pane appears.

  3. Select .
    A new row is added to the grid.
  4. In the ID cell, enter the parameter ID exactly as it appears in the R script.
  5. In the Name cell, enter a name for the parameter as you want it to appear to the Policy Designer user.
  6. In the Type list, select the data type of the parameter.
  7. In the Direction list, specify whether the parameter represents an input or an output to the R script.
  8. If the parameter is an input and is required, select the Required check box.
  9. For each parameter in the R script, repeat steps 3 through 8.
  10. Select .
    The R script parameters are defined.

Delete Parameters in R Scripts

Procedure

  1. Access the R script containing the parameter that you want to delete.
  2. At the bottom of the page, select the Parameters tab.
    The Parameters pane appears.

  3. On the left side of the Parameters pane, select the check boxes in the rows for the parameters you want to delete.
  4. In the upper-left corner of the pane, select .
    The parameter is removed from the Parameters pane.
  5. Select .
    The R script parameters are deleted.

Delete an R Script

Procedure

  1. Access the Catalog page for the folder that contains the R script that you want to delete.
  2. Select the check box that corresponds to the R script that you want to delete.
  3. In the upper-right corner of the page, select .
    A confirmation message appears, asking if you really want to delete the R script.

  4. Select OK.
    The R script is deleted.