[R] R-Excel Macro mode

Puijman, R. r.puijman at student.tue.nl
Wed Oct 27 13:29:57 CEST 2010


I'm using R-Excel's macro mode to make an R based Excel tool for inventory management. It's quite a lot of R-code which I made in R at first and now I am trying to transform it into excel. The R code is a simulation of a random path x times, put into matrices and then doing some transformations on it.

I pasted the R code on a seperate sheet in my Excel file, which by means of VBA I read with RInterface.RunRCodeFromRange Range(...). Before this, I put Excel data to the required R variables with the RInterface.PutArray "...",Range(...). After the code is run, I want to get the variables from the code, which I want to do with GetArray.

The model seems to work fine for small numbers of x, but with more than 5000 simulations, I get a VBA Run-time error '6', Overflow. The code works in R itself so I assume there is no problem in the code itself, but there is something wrong in the way VBA reads the code.

Can someone help me? According to VBA, the error means that I am trying make an assignment that exceeds the limitations of the target of the assignment. I don't understand why there is a tipping point in the number of simulations for which it works and for which it doesnt?

Thanks!

Roy



More information about the R-help mailing list