java - How to add double elements to RList? -


i tried call r rserve using java code. wanted use rexpgenericvector store , pass array r:

rlist r = new rlist(); r.add(new double(1.0)); rexpgenericvector v = new rexpgenericvector(r);  // make new local connection on default port (6311) rconnection c = new rconnection(); // assign data variable x c.assign("x",v);  system.out.println("printing out v:"+v); 

however, error message shows @ c.assign("x",v);:

java.lang.classcastexception: java.lang.double cannot cast org.rosuda.rengine.rexp @ org.rosuda.rengine.rlist.at(rlist.java:103) @ org.rosuda.rengine.rserve.protocol.rexpfactory.getbinarylength(rexpfactory.java:489) @ org.rosuda.rengine.rserve.rconnection.assign(rconnection.java:272) @ com.xypress.test.main(test.java:29) 

how can add double or string or other type of data rlist?

thanks in advance.

i ran in same trap! try class rexpdouble, instead of double.

for example: double doublevalue = 1.0; r.add(new rexpdouble(doublevalue));

that should work.

if know more @ web page: http://icbtools.med.cornell.edu/javadocs/rserve/org/rosuda/rengine/rexpdouble.html


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -