Saving and Loading a Model

Jul 15, 2015 at 4:50 PM
Hi, I'm relatively new to R.Net, so any help would be greatly appreciated. I'm generating a Generalized Linear Regression (Poisson), with some data (from now on DataBase). What I want to do, is to store this model somewhere, then load it and use to predict an output for another data (from now on PredictBase). This is what I currently have:
            REngine engine = REngine.GetInstance();
            DataFrame testData = engine.Evaluate("testData<-read.table('C:/Users/Felipe/Desktop/rfile.txt',header=TRUE)").AsDataFrame(); ----> From there I'm loading the DataBase
            engine.SetSymbol("modelexpression",engine.CreateCharacter(modelstring)); ---> modelstring is a string containing the expression for the glm
            engine.SetSymbol("testData", testData);
            NumericVector coeff = engine.Evaluate("coefficients(glm(modelexpression,family=poisson(link=log)))").AsNumeric();
This is currently working, and coeff gives me the coefficients for each independent variable.

From there I'm stuck with how to store a model (maybe to a txt file?) and then load it for new data in order to predict its output. Thanks in advance,

Felipe moya