title: Calculate cumulative product based on date by category
body: <p>I want to add a new column to my data.table containing the cumulative product of <code>Data1</code> based on the <code>Date</code>. The cumulative product should be calculated for each category (<code>Cat</code>) and should start with the latest available <code>Date</code>.</p>
  
  <p>Sample data:</p>
  
  <pre><code>     DF = data.frame(Cat=rep(c("A","B"),each=4), Date=rep(c("01-08-2013","01-07-2013","01-04-2013","01-03-2013"),2), Data1=c(1:8))
       DF$Date = as.Date(DF$Date , "%m-%d-%Y")
       DT = data.table(DF)
       DT[ , Data1_cum:=NA_real_]
       DT
  
          Cat      Date Data1 Data1_cum
       1:  A 2013-01-08     1    NA
       2:  A 2013-01-07     2    NA
       3:  A 2013-01-04     3    NA
       4:  A 2013-01-03     4    NA
       5:  B 2013-01-08     5    NA
       6:  B 2013-01-07     6    NA
       7:  B 2013-01-04     7    NA
       8:  B 2013-01-03     8    NA
  </code></pre>
  
  <p>The result should look like this:</p>
  
  <pre><code>        Cat      Date Data1 Data1_cum
       1:  A 2013-01-08     1    1
       2:  A 2013-01-07     2    2
       3:  A 2013-01-04     3    6
       4:  A 2013-01-03     4    24
       5:  B 2013-01-08     5    5
       6:  B 2013-01-07     6    30
       7:  B 2013-01-04     7    210
       8:  B 2013-01-03     8    1680
  </code></pre>
  
  <p>I figured out that I could do something similar using <code>cumprod()</code>, but I do not know how to handle the categories. <code>NA</code>s in <code>Data1</code> should be ignored / treated as 1.
  The real dataset has about 8 million rows and 1000 categories.</p>