title: R - split list by defined interval
body: <p>I have a list of files whose length will always be a multiple of 12. This is a simplified sample:</p>
  
  <pre><code>files &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"
  )
  </code></pre>
  
  <p>Those files are satellite images. There are always 12 files (or bands) for each single date. In this case, there are five groups (dates) with 12 files each, totalling 60 elements.</p>
  
  <p>What I need to do is to split this list into groups of 12, ideally creating a new variable. Using the sample data provided above, the new variable would have five elements (corresponding to dates), each one containing 12 files:</p>
  
  <pre><code>new&lt;-list()
  length(new) &lt;- length(files)/12
  
  # CODE BELOW DOESN'T WORK. I JUST WANT TO SHOW WHAT I NEED TO DO
  new[1] &lt;- files[1:12]
  new[2] &lt;- files[13:24]
  new[3] &lt;- files[25:36]
  new[4] &lt;- files[37:48]
  new[5] &lt;- files[49:60]
  </code></pre>
  
  <p>How to find a generic solution for this problem? Generic in the sense that the original list of files will always be a multiple of 12, but not always have lenght of 60 elements - sometimes 72, and sometimes 120.</p>
  
  <p>Thanks in advance for any help.</p>