I have a RM process that invokes a R script deep within its iterative structures, thousands of times.
The R script first defines a number of lengthy functions, which it then proceeds to use. Unfortunately this means that the same functions are defined/loaded again and again, for each call to the Execute R Script operator, resulting in substantial overhead, I presume.
I would much prefer to define the functions once (in a separate R script), in a way that allows their existence to persist so that they can be called from subsequent executions of the iterated R script operator.
Is this possible, or does each Execute R Script operator necessarily start and end with a cleared environment?
you can output arbitrary objects from the Execute Script (R) operator and use them as input for other R operators.Thus you could create your functions once and pass them to the operators using them.
If you have any questions related to this please post them here.