R-(D)COM, using custom R functions from Matlab

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

R-(D)COM, using custom R functions from Matlab


I'm a very new Matlab user, and a 3-year user of R.

I need to run custom R functions from Matlab.  So far I have been able to:

open an R session from Matlab, write R functions using, for example, evalR('test = function(x){ x + 2}').  However, I need to use the R source() command from Matlab to access longer custom R functions (those that will not fit on one line), but when I try:

evalR('source(''test.r'')')  for example, I get the following error...

??? Error using ==> evalR at 58
Problem evaluating command source('test.r').
Invoke Error, Dispatch Exception: Object is static; operation not allowed

Any insight in to this problem would be appreciated.

Also, I was wondering how (at the Matlab command prompt) to extend a single command across two or more lines so as to be able to write longer R functions using the evalR link from the command line?

Thanks for the help!