How to read large size of model file

Mar 12, 2014 at 10:47 AM
Edited Mar 13, 2014 at 10:22 AM
I need your favor, it is urgent !

My Code Is,
  engine.Evaluate("load('E:/RprogrammingFiles/rfmodel.RData')");
I tried to read .Rdata file with file size 202 MB but i am getting following error,
"RDotNet.ParseException: Error in the application"
Any idea how to solve this
Thanks
Developer
Mar 13, 2014 at 9:10 PM
I can only advise you to try to build R.NET from the latest code on the branch 'jperraud', as the error message is likely to be more informative, if the error persists. The API has changed a bit to initialise the REngine, (use RENgine.GetInstance instead of REngine.CreateInstance).
Mar 14, 2014 at 12:44 PM
Thanks for your reply,

I faced the following error when i read the large size file,

" cannot allocate vector of size 209.1 MB "

Any idea how to solve this
Thanks
Developer
Mar 14, 2014 at 8:15 PM
That is an issue with R, not R.NET. I could reproduce the issue with the following code in RGui.exe, without R.NET involved. I suggest you try to reproduce it in R, look for similar issues reported on StackOverflow, and post a question if you do not find answers already posted.

R version 3.0.2 (2013-09-25)
Platform: i386-w64-mingw32/i386 (32-bit)
> blah <- rep(1:3, 1e7)
> blah <- rep(1:3, 1e8)
> blah <- rep(1:3, 2e7)
Error: cannot allocate vector of size 228.9 Mb
> blah <- rep(1:3, 2e7)
Error: cannot allocate vector of size 228.9 Mb
> rm(blah)
> blah <- rep(1:3, 2e7)
Mar 14, 2014 at 8:58 PM
Hmm, are you loading items before? That looks like an out of memory error. Evaluate a call to w

warnings()

afterwards to check, also look at gc()
Mar 17, 2014 at 6:27 AM
Edited Mar 17, 2014 at 6:28 AM
Hi jperraud

Thanks for your reply.
my code as below,
              REngine engine = REngine.CreateInstance("RDotNet");
              engine.Initialize();
              engine.Evaluate("require(randomForest)");
              engine.Evaluate("load('E:/RTEST/rfmodel-03142014.RData')");   //Error line
              engine.Evaluate("tr<-read.csv('E:/RTEST/test_snhu.csv')");
              engine.Evaluate("pred<-predict(rf,tr)");
              engine.Evaluate("Sno<-tr$Sno");
              engine.Evaluate("write.csv(pred,'E:/RTEST/output.csv')");
I am getting error( cannot allocate vector of size 209.1 MB ) in 4th line. Its perfectly worked in R (R.exe and RGui.exe,), but problem when i used this code in DOTNET.

Any idea how to solve this
Thanks
Developer
Mar 17, 2014 at 7:30 AM
This is unlikely to be an R.NET issue, even if this happen to occur when run from R.NET.

It certainly is machine dependent (the sample code I used to reproduce on a 32 bit laptop works fine on a 64 bit machine, both 32 and 64 bit R)
You should look at the function memory.limit, and search e.g. in StackOverflow for questions with a similar error messages; there are plenty of them.
If you have a 32 bits OS and/or limited RAM (you do not provide information), this is the likely cause. You may or may not be able to overcome your issue using R settings; you might even need to upgrade your hardware.