I'm trying to use run-program to set up a simple interface to the
statistical language R.  I just want to send text commands to an R
process, maybe read some results back as text, make some graphics,
etc.

I'm starting R using:

(defparameter *e* (extensions:run-program "/home/rif/Software/R/bin/R" '("--no-save") 
                                        :pty t :wait nil :input :stream :output 
:stream :error :output))


The process starts OK.  I can use the process-output slot to read all
the things R normally prints out at startup time.

I'd like to be able to make R plot by saying

* (write-line "plot(rnorm(3000))" (extensions:process-input *e*))
"plot(rnorm(3000))"
* (finish-output (extensions:process-input *e*))
NIL
* 

but this has no effect.  I have one idea that may be related to the
problem.  If I run R without the --no-save option, it fails
immediately.  Looking at the internals of R, it appears that it runs

R_interactive = isatty(0);

and that for the process started from CMUCL, this is returning 0, so
it doesn't believe it's in an interactive R process.  I'm guessing
this relates to the problem, but I'm not sure how to proceed.  This
could be more of an R issue than a CMUCL issue, but any advice or
suggestions people can offer will be appreciated.

Cheers,

rif


Reply via email to