Re: [R] capturing stderr/stdout

2008-11-21 Thread Prof Brian Ripley
Sundar Dorai-Raj wrote: Hi, Prof. Ripley, Thanks for the reply. Mostly I want to capture output as it is written to the stream. For example, I quite often do the following to view the progress of a log file from a computationally intensive script. 1. Open a console and type: Rscript script.

Re: [R] capturing stderr/stdout

2008-11-21 Thread Sundar Dorai-Raj
Hi, Prof. Ripley, Thanks for the reply. Mostly I want to capture output as it is written to the stream. For example, I quite often do the following to view the progress of a log file from a computationally intensive script. 1. Open a console and type: Rscript script.R >& script.log which di

Re: [R] capturing stderr/stdout

2008-11-20 Thread Prof Brian Ripley
I am not sure what the issue is here. Do you want to capture both stderr and stdout (use 2>1 in the command with an sh-like shell), or is the problem that you don't get immediate output? The latter is a Perl issue: you need to circumvent output buffering. See e.g http://perl.plover.com/FAQs/Buf

[R] capturing stderr/stdout

2008-11-20 Thread Sundar Dorai-Raj
Hi, I have an application in perl that prints some output to either stderr or stdout. Here's an example: # tmp.pl print STDERR "starting iterator\n"; for(my $i = 0; $i < 100; $i++) { print $i . "\n"; } # tmp.R con <- pipe("perl tmp.pl") r <- readLines(con, n = -1) close(con) However,