Is it possible to use an object defined in C# to serve as an input to R function/command using R.NET -


i using r.net library call r functions in c#. want define or construct input in c# , pass r command. tried :

engine.evaluate("library(mirt)"); engine.evaluate("x=mirt(science,1)"); s4object obj111 = engine.getsymbol("x").ass4(); engine.evaluate("pl=x@pl"); numericvector pl_c= engine.getsymbol("pl").asnumeric(); int[] resp_c = new int  [] {1,1,1,1}; engine.evaluate("ff=fscores(x, response.pattern=resp_c)"); 

while trying came across error says,

"resp_c" not found.

is there way pass input r functions c# without writing input explicitly in double quotes nothing r script.

thank response in advance.

not expert of c#, quick glance @ the doc reveals can achieve want through:

int[] resp_c = new int  [] {1,1,1,1}; integervector resp_cr = engine.createintegervector(resp_c); engine.setsymbol("resp_c", resp_cr); engine.evaluate("ff=fscores(x, response.pattern=resp_c)"); 

you need create r object out of c# array , give symbol it.

honestly, never programmed in c#, programmed in java , in jri (java/r integration) , have idea how pass java object r. can't test , cannot sure if work, maybe can find helpful in way.


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -