On Sat, 21 Apr 2007, ivo welch wrote: > I spoke to soon. cat("hello", file=stderr()) does not "punch through" > R CMD BATCH test.R. Is there a way to have stderr() messages escape > the log and go directly to the invoking terminal (i.e., under > linux/unix, late-release gentoo). Maybe this should require a > different name than "BATCH", so as to not break scripts that rely on > nothing escaping. I find it very convenient in long scripts written > in perl or C to have the ability to write "blips" to the terminal, > too...
Well, R CMD BATCH sends STDERR to the file (the help does say Description: Run R non-interactively with input from 'infile' and send output (stdout/stderr) to another file. ) but look at the script: in 2.4.1 Unix-alikes cat ${in} | ${R_HOME}/bin/R ${opts} ${R_BATCH_OPTIONS} >${out} 2>&1 is the key part. So R --vanilla < infile > outfile is likely to do what you want. In 2.5.0 Rscript is even easier to use. > sincerely, > > /ivo welch > > > On 4/20/07, ivo welch <[EMAIL PROTECTED]> wrote: >> thank you, peter and brian. I had not found the stderr() function. >> (I had looked at the R Input/Output guide.) This is great. regards, >> /ivo >> > -- Brian D. Ripley, [EMAIL PROTECTED] 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@stat.math.ethz.ch 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.