[R] Appending diagnostic information to all lines sent to stdout and stderr

2008-06-19 Thread Thomas Allen
Dear All I'm logging the stdout and stderr of an R program into two separate files (stderr.txt and stdout.txt) using sink() I would like to append extra information such as date, memory usage etc to every line of output that goes to stdout or stderr. For example cat(hello \n) should give

Re: [R] Appending diagnostic information to all lines sent to stdout and stderr

2008-06-19 Thread Prof Brian Ripley
Is this actually possible? Yes. All R output to stdout/stderr that will get redirected by sink() passes through a connection. You can modify the sources to make a connection which adds info. Whether the information you want is available at that point is another matter -- and for things