title: sum/aggregate data based on dates, R
body: <p>I have a data set like following:</p>
  
  <pre><code>Date            Country    Item    Qty    Value
  15-04-2014      SE         08888   2      20
  28-04-2014      SE         08888   2      20
  05-05-2014      SE         08888   6      80
  </code></pre>
  
  <p>I want to sum quantity values when the dates are before the 1 May, and the aggregated value (the sum) should be marked as 1 May.</p>
  
  <p>I tried <code>ddply</code>, but it sums all the value regardless of the dates.</p>
  
  <pre><code>ddply(se, .(se$Item), summarize, Qty = sum(se$Qty), Value = sum(se$Value))
  </code></pre>
  
  <p>Also tried subsetting by the date, with no big success.</p>
  
  <pre><code>se$Date &lt;- as.Date(as.character(se$Date))
  se_q &lt;- subset(se,se$Date &lt;= 01-05-2014)
  
  Date         Country Item     Qty    Value
  0015-04-20   SE      08888    2      20
  0028-04-20   SE      08888    2      20
  0005-05-20   SE      08888    6      80
  </code></pre>
  
  <p>How could I add the date argument in the code? or how could I do this?</p>
  
  <p>Thank you</p>