Hi Julien,

I don't know why this specifically is happening.
But I've encountered this exception before.
In general, when calling R through COM some syntax forms
will not work properly.  I remember that a few times I
had to to find equivalent syntax because my first choice
of syntax simply would not work even though in RGui it
worked perfectly fine.  What I would suggest then is to
go with the flow and don't concatenate statements if you
don't have to  :-)

Best,
Michal Blazejczyk



Julien Vanwinsberghe <[EMAIL PROTECTED]> wrote:
> Hi all,

> I'm still experimenting R call from C#, and I've encountered a very 
> basic problem : a COM Exception when I try to concatenate R code lines 
> before evaluate :

> /System.Runtime.InteropServices.COMException : Object is static;
> //operation not allowed (Exception from HRESULT: (OLE_E_STATIC))/

> following code works fine :

> rObj.EvaluateNoReturn("a <-2;");
> rObj.EvaluateNoReturn("b <-3;");
> object result = rObj.Evaluate("a + b;");
> MessageBox.Show("a + b = " + ((double)result).ToString());

> but this one not ('b' is not know) :

> string R_SCRIPT = "";
> R_SCRIPT += "a <-2;";
> R_SCRIPT += "b <-3;";
> rObj.EvaluateNoReturn(R_SCRIPT);
> object result = rObj.Evaluate("a + b;");

> Would you know why ?

> Thanks



_______________________________________________
Rcom-l mailing list
[email protected]
http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l
More information (including a Wiki) at http://rcom.univie.ac.at

Reply via email to