R Execute (DB)
To configure R Execute, connect a valid data source to the R Execute operator. An intermediate operator also constitutes a data source for R Execute.
Information at a Glance
|
Parameter |
Description |
|---|---|
| Category | Tools |
| Data source type | DB |
| Send output to other operators | No |
| Data processing tool | R engine |
R Execute (DB) is for database data only. For Hadoop data, use the R Execute (HD) operator.
For information about configuring and using this operator, see R Execute.
Input
Specify that you require the input dataset by referring to an R object called alpine_input in the script. This is a data frame object.
You might choose not to use the input dataset (by not referring to alpine_input in the script), in which case the data is not read in to R.
- If the input is a preceding operator, the preceding operator runs, but the data is not transferred to R if you do not use alpine_input in the script.
- If the preceding operator is a data source (a database table), the database query does not run, saving execution time.
Restrictions
See the topic "R Execute Prerequisites" in TIBCO® Data Science - Team Studio System Requirements for information about package, system, and server requirements.
Configuration
| Parameter | Description |
|---|---|
| Notes | Notes or helpful information about this operator's parameter settings. When you enter content in the Notes field, a yellow asterisk appears on the operator. |
| R Script | The R Script to execute. Select
Define Clause to specify the R script.
See: Define R Script dialog. |
| Output Schema | Specifies the database schema to contain the table representation of the R Execute output data frame. |
| Output Table | Specifies the name of the database table, within the schema defined above, where the table representation of the R Execute output data frame is stored. |
| Drop if Exists |
|
| Pass Output Table | Required only if R Execute is not a terminal operator.
Specify whether to pass the R Execute output to the next operator. This option is important if you want to R Execute the operator's output to the next operator. If Pass Output Table is set to Yes, then the Result Table Structure details must be configured. Default value: No |
| Result Table Structure | Specify the table structure of the operator output to pass to the next operator.
This option dynamically pulls the values from the alpine_output variable in the R script. The values do not populate until you have run the R script once. Enabled only if Pass Output File is set to Yes. For more information, see Edit Table Columns dialog. The following code provides an example of how to use alpine_output: print("hello")
foo = c("setosa", "virginica", "versicolor")
alpine_output = data.frame(class = foo,
predicted_class = foo) |
Output
If the alpine_output object does not exist in your R code, then the output is not generated. If you set Pass Output Table to Yes, and if the R script does not contain a reference to the alpine_output object, then the flow fails at runtime, and an error message is displayed for this inconsistency.

If you create an alpine_output object in the R code, then the R Execute operator output displays the output data frame (persisted in the database) in the results console in the Data tab.

If your R code included functions that printed output to the R console, then the output is displayed in the results console in the R-Console Output tab.
summary(alpine_input), it is shown in the R console or RStudio console. However, because R Execute is capturing the console output into an object (which is executed in R using R's
capture.output function), you must wrap such calls using the
print() function. For example, instead of
summary(alpine_input), specify
print(summary(alpine_input)). This is a limitation of how R's
capture.output function works.

Your R code is shown in the results console in the R-Script tab.