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 flow, in order to perform a specific operation that requires a low-level programming language, such as deciphering badly formatted text files.


Prerequisites

  • you must have created a flow;

  • R software is installed where Rulex is running.

  • Miniconda must have been installed on the machine where Rulex Factory is running.


Procedure

  1. Drag 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.

Import from R script options

Name

Description

Advanced Configuration options

Select executable type

Select the executable type you want to use in the task. The options available are:

  • Conda

  • Python

The Configuration tab changes according to the selected executable.

Executable file area

Drag the Python executable file on this area if you have chosen Python as the executable file type, or drag the conda executable file here if you have chosen Conda as the executable file type. You can browse on your machine to upload the file by clicking on the Select button.

Configuration tab

Use user environment

Select this checkbox if you want to use the environment created by Rulex. This option is available only if Conda has been chosen as the executable file type.

Select Conda Environment

In this drop down list, choose the Conda environment you want to use in the task. This option is available only if Conda has been chosen as the executable file type.

Console tab 

Connect R Bridge

Click on it to open the Interactive Console, where you can write the code. 

Interactive Console

Here you can write the code which will be executed within the task.

The dataset is saved as r_dataset onto the task. So every time you need to write code referring to the dataset, use this reference in the Console or in the Script tabs. The flow variables are saved as r_vars.

Save History

Click on this button to save the changes made to the code. The code will be printed in the Script.

Clear History

Click on this button to delete all the changes made to the code.

Script tab (available for both Python and Conda executable files)

R Editor

Here you can visualize and edit the code, just like in the Interactive Console in the Console tab.

Execute Code

Click this button to execute the code and visualize the results in the Last Execution Output area.

Save Code

This button saves the code written in the Script area.

Last Execution Output

Here you can visualize the output of the last code execution.