Skip to content
Prev 1427 / 2152 Next

mclapply: problem writing into a texfile within a loop

On Jul 10, 2012, at 9:28 AM, Mauricio Zambrano-Bigiarini wrote:

            
Simply add
flush(TextFile)
after the second writeLines(). Since you're forking the processes without flushing the buffers, the buffers get flushed as the processes exit and thus creating each one copy of the unflushed output for each process. Obviously, using makeCluster() does't have that effect since it creates new, independent processes.

Cheers,
Simon