This project is read-only.

Serialize object from R

Jan 16, 2015 at 4:27 PM

I use R.Net and greate gml datamining model. Then I do sth like that:

var model = engine.GetSymbol("full.logit");

Now I would like to serialize this model object to be able to use it next time I run the app but I get an error:

Type 'RDotNet.SymbolicExpression' in Assembly 'RDotNet, Version=, Culture=neutral, PublicKeyToken=null' is not marked as serializable.

so is there any other way I can persist objects from R session?
Jan 16, 2015 at 10:06 PM
RDotNet.SymbolicExpression is effectively a sort of pointer to an address in memory; it is by nature very difficult to impossible to make it serializable. You have to use the save/load functions in R and get the symbol in each session.
engine.Evaluate("save(full.logit, file='c:/path/to/myfile.rda')");
In another session:
var model = engine.GetSymbol("full.logit"); 
Oct 25, 2015 at 10:48 PM
So, Is it possible to get lightweight version of SymbolicExpression, marked as Serializable?
Other question - If I need to realize RPC via TCP/IP or named pipes, what should I do? Is this any way to create dynamic proxy for REngine class which allow to create multiple instances of R (via different processes connected by TCP/IP through serialization data)?