[Rd] ASCII dump from an REXP (JRI)

From: way4thesub <kapelner_at_stanford.edu>
Date: Wed 19 Jul 2006 - 02:56:37 GMT

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@1b000e7]
	RXP[unknown/6, id=1204356856, o=null]
	RXP[unknown/6, id=1204325140, o=null]
	RXP[int[], id=1203946856, o=[I@b76fa]
	RXP[double[], id=1210952032, o=[D@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.

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Wed Jul 19 12:59:57 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 19 Jul 2006 - 16:27:50 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.