Re: [R] R command line usage

From: Prof Brian Ripley <>
Date: Mon, 28 Jan 2008 07:44:59 +0000 (GMT)

On Sun, 27 Jan 2008, Deepak Chandran wrote:

> Hello,
> Usually if I want to run R code from another program, I generate an
> R script and run R BATCH. However, I have been wanting to access R's
> command line from another program. In other words, I want the std output
> from another program to feed into R (command line). Is there any way to
> do that? I would also like to collect R's response using std input.

You haven't told us your OS (see the posting guide), but 'R CMD BATCH' is for batch use which this is not. On Unix, use R directly, on Windows use Rterm.exe

On both systems pipes work in a decent shell, so you can do things like

prog1 | R --slave | prog2

or you can use Rscript.

Brian D. Ripley,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Mon 28 Jan 2008 - 07:52:03 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 28 Jan 2008 - 08:30:10 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive