title: cumsum() up to and including current date in dplyr
body: <p>I want to calculate cumulative sum of values over all dates prior to and including current date. The problem is that i have multiple entries for the same date, so if I use cumsum I get different values for the values that happened on the same date:</p>
  
  <pre><code>library(dplyr)
  tribble(~date, ~value,
          "2017-01-01", 1,
          "2017-01-02", 2,
          "2017-01-02", 3,
          "2017-01-03", 4,
          "2017-01-03", 5,
          "2017-01-04", 6,
          "2017-01-09", 9) %&gt;% 
    arrange(date) %&gt;% 
    mutate(to_date=cumsum(value))
  &gt;
  # A tibble: 7 x 3
          date value  to_date
         &lt;chr&gt; &lt;dbl&gt;    &lt;dbl&gt;
  1 2017-01-01     1        1
  2 2017-01-02     2        3
  3 2017-01-02     3        6
  4 2017-01-03     4       10
  5 2017-01-03     5       15
  6 2017-01-04     6       21
  7 2017-01-09     9       30
  </code></pre>
  
  <p>Is there an elegant way of getting to the following output:</p>
  
  <pre><code># A tibble: 7 x 3
          date value  to_date
         &lt;chr&gt; &lt;dbl&gt;    &lt;dbl&gt;
  1 2017-01-01     1        1
  2 2017-01-02     2        6
  3 2017-01-02     3        6
  4 2017-01-03     4       15
  5 2017-01-03     5       15
  6 2017-01-04     6       21
  7 2017-01-09     9       30
  </code></pre>
  
  <p>For various reasons (among other things that I have many more fields in my table) I can not afford to summarize by data prior to running cumulative total. I (likely) need a growing window function that can calculate totals for time intervals.</p>