Creating and Sharing an R Extension

You can enable a partner extension with R script and publish it to the SAP Analytics Extensions Directory, where you can also consume R Extensions written by others.

The following are the system requirements and configuration process to create and export an R Extension.

Prerequisites:
  • Server: SAP HANA system (SPS 9+) with PAL, APL and R configured.

  • Client: Predictive Analytics 2.5+ installed and R configured.

Configuration Process:

To create or edit an R Extension, take the following steps:

  1. Load a dataset to Expert Analytics.
  2. Go to the Predict room.
  3. Below the Components List on the right-hand side of the window, click the + icon to reveal the context menu. From the menu, select R Extension to launch the editor to create a custom R Extension.
  4. The Create New R Extension dialog box opens at the General tabbed page. Configure the following settings:
    1. Add an Extension Name.
    2. Add an Extension Type. Choose Data Writer (for agnostic only) and Data Prepare (for SAP HANA and agnostic).
    3. If you chose Algorithms as the Extensions Type, select an algorithm Category to which the extension is added. Choose from the following predefined categories: Association, Classification, Clustering, R Extensions, Decision Trees, Neural Networks, Outliers, Regression and Time Series. In Expert Analytics version 2.5, for the Data Writer and Data Prepare extension types, the Category field is disabled and the only option is R Extensions.
    4. Optionally, enter a description to the text box, Extension Description.
    5. To enable recipients to edit, select the checkbox, Make editable when shared.
  5. Click Next.
  6. In the Script tabbed page, choose from the following options:
    1. Add/Write R script to the Script Editor.
    2. Set the input parameters as necessary. They include Primary Function Name, Input DataFrame, Output DataFrame and Model Variable Name.
    3. Select the checkboxes as necessary. They include Show the Visualization, Show Summary and Option to save the model.
  7. Click Next.
  8. In the Settings tabbed page, configure the output parameters to appear in the configuration panel at a future time when the extension is consumed in a chain. Select from the following options:
    1. In the Output Table Definitions, select one of the following checkboxes: Consider all columns from previous component or Consider none. The component generates one predicted column and your selection will affect the Results Tab. For example, suppose the previous component contains five columns. If you consider all columns from the previous component, the Results tab will display the five previous component columns plus the newly-generated predicted column. In this example, that means six columns. If you consider no columns from the previous component, the results tab will display only the newly generated column.
    2. Choose a Data Type for each output column name.
    3. Enter a New Predicted Column Name for each output column name.
  9. Configure the input parameters to appear in the configuration panel at a future time when the extension is consumed in a chain. In Property View Definitions, select from the following options:
    1. Function Parameters: The parameters of the primary function or the model score function.
    2. Property Display Name: Optionally, enter a property display name for any function a parameter to appear in the configuration window. Use to help users make a more intuitive selection.
    3. Control Type: Enables you to decide how you want users to input this parameter. The input methods include text box, dropdown box, combo box, single column selector and multiple column selector.
    4. Settings icon : Use to set a mandatory field and choose the default input data type from the following list: String, Integer, Double and R-Literal.
  10. Click Finish. The R Extension is encrypted and saved on the local file system. The component list in Expert Analytics is updated with the new R Extension name under the appropriate category.
  11. The updated R Extension appears in the Component List under the appropriate section. (For example, if you create Data Writers, it appears in the Data Writers section.) Take any or all of the following actions:
    1. Identify the R Extension in the menu via the EXT identifier.
    2. View the R Extension description by clicking the extension name.
    3. Export to a .spar file for sharing.
    4. Save the file via File Explorer.
    5. Share it via the Portal at this address: http://www.sap.com/bi-partner-extensions.
    6. Edit in the R Extension editor window. Option, available only to the author.
    7. Delete. This option cannot be undone. The associated files are deleted from the system immediately.

You have enabled partner extensions with R script and seen how easily -- and securely -- extensions can be shared with partners.