[R] running R from Perl

Andrew Perrin aperrin at email.unc.edu
Tue Aug 7 15:38:34 CEST 2001


I'm certain it's possible, although I haven't tried it myself. The two
possibilities I can think of off the top of my head are:

1.) Use R's ability to read and write to/from sockets. Perl is happy to
open sockets (perldoc Socket), so you should be able to send data back and
forth that way. In R, see:

> apropos('socket')
[1]
"close.socket" "make.socket"  "print.socket" "read.socket"  "write.socket"


2.) Send the data to a temporary file from perl, then launch R with a
batch script to read the data and write the plot to a temporary file, then
read the temporary file from perl.

Hope this helps.

----------------------------------------------------------------------
Andrew J Perrin - andrew_perrin at unc.edu - http://www.unc.edu/~aperrin
 Assistant Professor of Sociology, U of North Carolina, Chapel Hill
      269 Hamilton Hall, CB#3210, Chapel Hill, NC 27599-3210 USA


On Mon, 6 Aug 2001, Evan Zane Macosko wrote:

> Hi everyone,
> 
> 
> I'm interested in running R remotely from a Perl program--specifically I
> want to plot some data in Perl and return the graph as an object to Perl.
> Does anyone know if this is possible?
> 
> Thanks,
> Evan
> 
> 
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list