R Model Node

The R Model Node allows arbitrary R Language scripts to be executed as part of a graph. 

The R Node allows functions to be defined which can be passed optional arguments. The return value of the function is the value of the last expression in the function. 

All arguments are passed as strings and so type conversions are necessary before manipulation as numeric values for example. The example function below returns the sum of the two numeric input arguments. The last expression evaluated is the function return value. 


In a graph it is necessary to map the input arguments and the return value from the function. Here the schema is being used to map the values for the arguments above: 


Resulting in the expected sum: 


Vector Arguments and Return Values

A vector can be represented in JSON as a string field with separators. This example shows how a string field using a comma as a separator can be used as an input value and transformed into an R vector of numeric values.  

Gives the expected result: 

Similarly return vectors can be transformed into separated string fields using the paste() function: 

which gives the expected response: 

Standard Whitelisted R Node Package and Functions

Xponent whitelists a standard set of R node packages and functions to use. Please contact Xponent Support if you require more details.

Any additional functions or packages will need to be submitted to Xponent Support and reviewed by Xponent security team prior to implementation.

We welcome suggestions for standard R libraries to be included in the standard package. 


Privacy Policy
© 2022 CSG International, Inc.