Message-ID: <19991206234508.34164@hal.stat.unipd.it>
Date: 1999-12-06T22:45:08Z
From: Guido Masarotto
Subject: perl advice
In-Reply-To: <384C34DC.C6AF00A2@wi.mit.edu>; from John D. Barnett on Mon, Dec 06, 1999 at 05:12:44PM -0500
On Mon, Dec 06, 1999 at 05:12:44PM -0500, John D. Barnett wrote:
> Hello-
>
> Does anyone have a recommendation on how to call R from perl? I'm using
> the IPC::Open2 module, and running R with the --slave and --quiet
> options. The problem is that I can't predict how many lines of output I
> should try to read for each command-- if any!
>
> The ultimate goal is to use perl to provide a form-driven web interface,
> but have R do the underlying calculations.
>
A trick that I have used sometimes from tcl/tk is to redefine the
prompt to some funny string (sending to the controlled process
a 'option(prompt=...) command at the beginning) and then wait
for the prompt on the output. If I remember also ESS
works in a probably less weaker but similar approach (i.e., it
waits for a particular regular expression on the standard output
of the R process).
Hoping this can help,
guido
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._