title: stdout and stderr of parallel computation in R
body: <p>I am using the package <code>parallel</code> to do computation. Here is a toy example:</p>
  
  <pre><code>library(parallel)
  m = matrix(c(1,1,1,1,0.2,0.2,0.2,0.2), nrow=2)
  myFun = function(x) {
    if (any(x&lt;0.5)) {
      write("less than 0.5", stderr())
      return(NA)
    } else {
      write("good", stdout())
      return(mean(x))
    }
  }
  cl = makeCluster(2, outfile="/tmp/output")
  parApply(cl, m, 2, myFun)
  stopCluster(cl)
  </code></pre>
  
  <p>The problem is both the stdout and the stderr will be redirected to <code>/tmp/output</code>. The <code>output</code> file looks like this:</p>
  
  <pre><code>starting worker pid=51083 on localhost:11953 at 11:37:12.966
  starting worker pid=51093 on localhost:11953 at 11:37:13.261
  good
  good
  less than 0.5
  less than 0.5
  </code></pre>
  
  <p>Is there any way to setup two separate files for the stdout and the stderr, respectively? and how to ignore the first two lines of "starting worker pid=..."?</p>