Importing Data from R Scripts

You can import data directly from an R Script, either by entering the script directly in the task, or by referencing an external script file.

This type of operation may be useful if you want to apply an external script to data before using it in a Rulex workflow, in order to perform a specific operation that requires a low-level programming language, such as deciphering badly formatted text files.

Prerequisites

Additional tabs

The following additional tabs are provided:


Procedure

  1. Drag and drop the Import from R script task onto the stage.

  2. Double click the Import from R script task.

  3. Configure the script options as described in the table below.

  4. Save and compute the task.

R bridge options

R bridge options

Name

PO

Description

General options

Get R script from file

scriptfromfile

Select this option to import the R script directly from a file, and not by manually entering the R code below.

Select R script

filename

Click here and browse to the external file, which contains the R script you want to apply.

This option will be enabled only if you have selected the Get R script from file option.

Store output in

outref

Select the type of table that will be populated by the data.frame selected as output in the R script.

Possible options are:

  • Dataset (i.e. the main data table)

  • Clusters

  • Advanced association structure (association rules, bundle hypotheses or replacement rules table).

Name of the output data frame in R script

routputname

Enter the name you want to use in the R script to reference the data Rulex will receive from R. This data will populate the table according to the option selected in Store output in

Select file to store R console output

debugfilename

Browse to the text file where the R script console output will be saved after execution of the R Bridge task.

R Code

rcode

Enter the R script code you want to execute.

This text box is enabled only if you have not selected the Get R script from file option.

Connection options

Select path to Rterm command

rcommand

Browse to the location of the Rterm command. The default path on a Windows system, corresponding to the default value of this option, is “C:/Program Files/R/R-3.3.2/bin/x64/Rterm.exe”.

If the path is not correctly specified, the R Bridge task will not work correctly and a warning message will be displayed.

The RBridge task cannot compute if another Rterm process is pending. You can monitor this on Windows via the Task Manager (Processes).

R host

rhostname

Enter the address of the host where R is installed. If Rulex is running on the same desktop where it is installed you can enter localhost.

R port

rport

Specify the port used for data transfer between Rulex and R (i.e. input table transfer from Rulex to R, output data frame transfer from R to Rulex).

 

System firewall exception

Make sure you define an exception in the system firewall on this port, allowing the data exchange between the two applications. Otherwise, the task will not be executed and a warning message will be displayed signaling a communication problem between Rulex and R.

 

R port for signals

rportaux

Specify the port used for signal transfer between Rulex and R (i.e. progress bar updates).

 

System firewall exception

Make sure you define an exception in the system firewall on this port, allowing the data exchange between the two applications. Otherwise, the task will not be executed and a warning message will be displayed signaling a communication problem between Rulex and R.

 





Need to get in touch? https://www.rulex.ai/contact/ - Need a license renewal? https://rulex.atlassian.net/servicedesk/customer/user/login?destination=portals
© 2024 Rulex, Inc. All rights reserved.