title: How to print a variable inside a for loop to the console in real time as the loop is running?
body: <p>I have a loop that takes a long time for each iteration, and I would like to see the progress of it in real time. How do I print a variable inside a for loop to the console in real time, as the loop is running? Each of these print everything after the loop is finished, which is useless for me:</p>
  
  <pre><code>for(i in 1:10){
    write(i,stdout())
  }
  
  for(i in 1:10){
    write(i,stderr())
  }
  
  for(i in 1:10){
    print(i)
  }
  1
  2
  3
  4
  5
  6
  7
  8
  9
  10
  </code></pre>