title: Sequentially create date for each record by ID in R datatable
body: <p>I have a datatable with ID and origination date, each unique ID represent a row. I have to use the variable 'COUNT' (which is essentially the interval between orig_date and close_date in months) and sequentially replicate ORIG_DATE into DATE field as shown. The code I tried is taking only the first value of 'COUNT' (in this case its 3) and sequentialy replicating ORIG_DATE. I have different COUNT for different ID. How do I use corresponding COUNT for each unique ID and replicate the ORIG_DATE into another column called DATE</p>
  
  <p>test.data</p>
  
  <pre><code>ID  COUNT   SCORE   VALUE   ORIG_DATE   CLOSE_DATE  
  10748   3   750 450231  2015-03-01  2015-06-01      
  10845   4   680 590231  2015-01-01  2015-05-01      
  21758   7   760 650839  2014-11-01  2015-06-01   
  
  test.panel &lt;- test.data[rep(sequence(nrow(test.data)),COUNT)]
  
  test.panel$DATE &lt;- ymd(test.panel$ORIG_DATE)+ months(1:test.panel$COUNT)
  </code></pre>
  
  <p>Given below is the structure of datatable I am trying to create</p>
  
  <pre><code> ID COUNT   SCORE   VALUE   ORIG_DATE   DATE
  10748   3   750 450231  2015-03-01  2015-03-01
  10748   3   750 450231  2015-03-01  2015-04-01
  10748   3   750 450231  2015-03-01  2015-05-01
  10748   3   750 450231  2015-03-01  2015-06-01
  10845   4   680 590231  2015-01-01  2015-01-01
  10845   4   680 590231  2015-01-01  2015-02-01
  10845   4   680 590231  2015-01-01  2015-03-01
  10845   4   680 590231  2015-01-01  2015-04-01
  10845   4   680 590231  2015-01-01  2015-05-01
  21758   7   760 650839  2014-11-01  2014-11-01
  21758   7   760 650839  2014-11-01  2014-12-01
  21758   7   760 650839  2014-11-01  2015-01-01
  21758   7   760 650839  2014-11-01  2015-02-01
  ..........................................................
  ..........................................................
  </code></pre>