title: R - How to print progress in a loop over list?
body: <p>I need to process a long list of images using a loop. It takes a considerable time to run everything, and therefore I would like to keep track of the progress.</p>
  
  <p>This is my loop:</p>
  
  <pre><code>files.list &lt;- c("LC82210802013322LGN00_B1.TIF", "LC82210802013322LGN00_B10.TIF", 
  "LC82210802013322LGN00_B11.TIF", "LC82210802013322LGN00_B2.TIF", 
  "LC82210802013322LGN00_B3.TIF", "LC82210802013322LGN00_B4.TIF", 
  "LC82210802013322LGN00_B5.TIF", "LC82210802013322LGN00_B6.TIF", 
  "LC82210802013322LGN00_B7.TIF", "LC82210802013322LGN00_B8.TIF", 
  "LC82210802013322LGN00_B9.TIF", "LC82210802013322LGN00_BQA.TIF", 
  "LC82210802013354LGN00_B1.TIF", "LC82210802013354LGN00_B10.TIF", 
  "LC82210802013354LGN00_B11.TIF", "LC82210802013354LGN00_B2.TIF", 
  "LC82210802013354LGN00_B3.TIF", "LC82210802013354LGN00_B4.TIF", 
  "LC82210802013354LGN00_B5.TIF", "LC82210802013354LGN00_B6.TIF", 
  "LC82210802013354LGN00_B7.TIF", "LC82210802013354LGN00_B8.TIF", 
  "LC82210802013354LGN00_B9.TIF", "LC82210802013354LGN00_BQA.TIF", 
  "LC82210802014021LGN00_B1.TIF", "LC82210802014021LGN00_B10.TIF", 
  "LC82210802014021LGN00_B11.TIF", "LC82210802014021LGN00_B2.TIF", 
  "LC82210802014021LGN00_B3.TIF", "LC82210802014021LGN00_B4.TIF", 
  "LC82210802014021LGN00_B5.TIF", "LC82210802014021LGN00_B6.TIF", 
  "LC82210802014021LGN00_B7.TIF", "LC82210802014021LGN00_B8.TIF", 
  "LC82210802014021LGN00_B9.TIF", "LC82210802014021LGN00_BQA.TIF", 
  "LC82210802014037LGN00_B1.TIF", "LC82210802014037LGN00_B10.TIF", 
  "LC82210802014037LGN00_B11.TIF", "LC82210802014037LGN00_B2.TIF", 
  "LC82210802014037LGN00_B3.TIF", "LC82210802014037LGN00_B4.TIF", 
  "LC82210802014037LGN00_B5.TIF", "LC82210802014037LGN00_B6.TIF", 
  "LC82210802014037LGN00_B7.TIF", "LC82210802014037LGN00_B8.TIF", 
  "LC82210802014037LGN00_B9.TIF", "LC82210802014037LGN00_BQA.TIF", 
  "LC82210802014085LGN00_B1.TIF", "LC82210802014085LGN00_B10.TIF", 
  "LC82210802014085LGN00_B11.TIF", "LC82210802014085LGN00_B2.TIF", 
  "LC82210802014085LGN00_B3.TIF", "LC82210802014085LGN00_B4.TIF", 
  "LC82210802014085LGN00_B5.TIF", "LC82210802014085LGN00_B6.TIF", 
  "LC82210802014085LGN00_B7.TIF", "LC82210802014085LGN00_B8.TIF", 
  "LC82210802014085LGN00_B9.TIF", "LC82210802014085LGN00_BQA.TIF"
  )
  
  for (x in files.list) { #loop over files
  
    # Tell about progress
    cat('Processing image', x, 'of', length(files.list),'\n')
  }
  </code></pre>
  
  <p>Of course, instead of showing the name of the file, I would like to show the index of the current file in the context of the length of the entire list.</p>
  
  <p>I really need the names of the files within the loop, because I need to load and save a new version of each one of them.</p>
  
  <p>Any ideas? Thanks in advance.</p>