Re: [R] calling R from within Java, using jri

From: <john.gavin_at_ubs.com>
Date: Fri 06 Oct 2006 - 08:54:51 GMT


Hi,

(I addressed the JRI issues I had in my previous email below http://article.gmane.org/gmane.comp.lang.r.general/70322 by working with the precompiled version of JRI that is part of the rJava package.)

So I can now run the JRI examples as expected but am having difficulty getting the Rengine to start with the '--vanilla' startup option set. When I run JRI's rtest example with the '--vanilla' argument set, it seems to have no effect but on the command line (inside rtest) I can see that the command line option was issued as expected:

> commandArgs()

rBusy(1)
[1] "Rengine" "--vanilla"
rBusy(0)
>

In addition, adding the line

  System.out.println("Print arguments " + args[0]);

just before passing the 'args' to the Rengine

  Rengine re=new Rengine(args, false, new TextConsole());

produces the expected output 'Print arguments --vanilla'.

So what is the correct way to get Rengine to accept the '--vanilla' argument?

Regards,

John.

John Gavin <john.gavin@ubs.com>,
Commodities, FIRC,
UBS Investment Bank, 2nd floor,
100 Liverpool St., London EC2M 2RH, UK.
Phone +44 (0) 207 567 4289

> -----Original Message-----
> From: Gavin, John
> Sent: 28 September 2006 12:42
> To: 'R-help@stat.math.ethz.ch'
> Subject: calling R from within Java, using jri
>
> Hi,
>
> I want to call R from within Java, using jri as per
> http://www.rosuda.org/software/jri/
> So I am following the instructions in the README file for JRI 0.2-4.
>
> I have run 'sh configure.win' and 'make' and they seemed to
> be successful.
> (See below for the output from make, for example.)
> But when I try 'run.bat rtest' (with and without R command
> line arguments)
> the output that I get is
>
> 'c:\temp\r\jri>C:/PROGRA~1/Java/JDK15~1.0_0/bin/java -cp
> .;examples;src/JRI.jar rtest $*
> Creating Rengine (with arguments)'
>
> That suggests that it gets to line 60 in rtest.java then
> stops on line 61,
> without producing an error. Line 61 is
>
> Rengine re=new Rengine(args, false, null);
>
> so it seems that I am not able to construct an Rengine.
> Can someone suggest what I might try next to track down the
> problem, please?
>
> I am running Java JDK 1.5.0 and R 2.3.1 on Windows NT.
>
> Regards,
>
> John.
This communication is issued by UBS AG and/or affiliates to institutional investors; it is not for private persons. This is a product of a sales or trading desk and not the Research Dept. Opinions expressed may differ from those of other divisions of UBS, including Research. UBS may trade as principal in instruments identified herein and may accumulate/have accumulated a long or short position in instruments or derivatives thereof. UBS has policies designed to negate conflicts of interest. This e-mail is not an official confirmation of terms and unless stated, is not a recommendation, offer or solicitation to buy or sell. Any prices or quotations contained herein are indicative only. Communications may be monitored.

  2006 UBS. All rights reserved.
Intended for recipient only and not for further distribution without the consent of UBS.



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri Oct 06 19:00: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 Fri 06 Oct 2006 - 09:30:08 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.