[Rd] ASCII dump from an REXP (JRI)

way4thesub kapelner at stanford.edu
Wed Jul 19 04:56:37 CEST 2006


Hi Simon,

Thanks so much for your help. Your advice has been taken to heart. I now
pass in blocks of 100,000 records, and it does 100,000 predictions in
seconds and returns a logical vector with the predictions to an int array.
It works like a charm!

I want to reference what we were talking about earlier. Let’s say we
evaluate an R expression. Is there a way to just print, verbatim, what R
evaluates to the screen (ie just a pure ASCII dump with no regard to the
data type)?

(I’m using Windows XP SP2, 2 x 1.8Ghz Xeon, 1GB RAM, Eclipse 3.1.1, JRI 0.2,
R 2.2.1, jdk1.5.0_07, jre1.5.0_06)

You mentioned earlier doing something as follows:

	rexp=reng.eval("nucleitrain");
	System.out.println("nucleitrain="+rexp);
	long[] l=reng.rniGetVector(rexp.xp);
	for (int i=0;i<l.length;i++)
		System.out.println(new REXP(reng, l[i]));

Now, Java outputs to the screen this: 

	nucleitrain=RXP[unknown/19, id=1218430184, o=null]
	RXP[unknown/19, id=1218430408, o=null]
	RXP[int[], id=1219416784, o=[I at 1b000e7]
	RXP[unknown/6, id=1204356856, o=null]
	RXP[unknown/6, id=1204325140, o=null]
	RXP[int[], id=1203946856, o=[I at b76fa]
	RXP[double[], id=1210952032, o=[D at b01d43]

Which means I have to anticipate each expression type and properly handle
it. If one does not know, a priori, what these expressions are, how can one
do it?

Ideally, I’m looking for something like the following:

	REXP rexp=reng.eval(“ . . . . “);
	rexp.DisplayToScreenAsRGuiDisplays();

I know this function exists because you wrote a Java interface to R. If it
does, it would be an awesome thing to put on an examples page.

Thanks,
Adam




-- 
View this message in context: http://www.nabble.com/ASCII-dump-from-an-REXP-%28JRI%29-tf1964220.html#a5390018
Sent from the R devel forum at Nabble.com.



More information about the R-devel mailing list