The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
Persistance in the R environment
tennenrishin
Member Posts: 177 Contributor II
Hi RM Support
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?
Regards,
Isak
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?
Regards,
Isak
Tagged:
0
Answers
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.
Best regards,
Marius