R error messages go to stderr, not stdout, so you need to redirect the latter. In most shells, including cmd.exe (which as you don't say is likely what you are using) you can use

Rscript test.R xxx.txt > error.log 2>&1

to redirect both stdout and stderr to the same file (see the rw-FAQ Q2.12).

On Tue, 8 Jun 2010, A Huang wrote:

Hi there,

I use Rscript.exe for batch run (actually it is used in ASP.net code)

c:>"C:\Program Files\R\R-2.10.1\bin\Rscript.exe" test.r xxx.txt

Where test.r is the r program and xxx.txt is a file name test.r will read in, 
it comes from
a web form. This works fine, when the file is in required format. Sometime, 
xxx.txt
has wrong format, test.r read in but can't process it. If I run interactive 
mode, I
probably can see the error message on the screen. But since this is running
as a background process, I don't really have a screen to see.

I tried redirct:

c:>"C:\Program Files\R\R-2.10.1\bin\Rscript.exe" test.r xxx.txt > error.log

But it doesn't work even in local windows.

Thanks

A. Huang


--
Brian D. Ripley,                  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help@r-project.org 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.

Reply via email to