title: R Programming and GGPLOT2 - how to SUM data to create a line graph
body: <p>I am very new to R and am looking to create a line graph using GGPLOT2 for a set of data I have.  The data is comprised of Dates,Comments,Qtys - there are multiple date/comment/qtys combination but what I need to do is get the data to a place where each date and comment combination has ONE value for qty - essentially to SUM them.  I know how do do that in SQL and am using the sqldf package to try to achieve the same but instead I get one row returned.  </p>
  
  <p>Sample Data: </p>
  
  <pre><code>Date     Comments         BuysToForecast
     &lt;fct&gt;    &lt;fct&gt;                     &lt;int&gt;
   1 4/6/2018 Approved                    573
   2 4/6/2018 ""                          363
   3 4/6/2018 ""                          503
   4 4/6/2018 ""                          324
   5 4/6/2018 Cancelled                  1844
   6 4/6/2018 Consumed By SO's            422
   7 4/6/2018 Consumed By SO's            790
   8 4/6/2018 Reduced                     515
   9 4/6/2018 Reduced                     790
  10 4/6/2018 Approved                   1378
  </code></pre>
  
  <p>what I need is for example = there would only be one 4/5/2018/Consumed By SO's/Qty value that would have all of the qtys.  When I use the below SQL in sqldf I get said the results shown: </p>
  
  <p>SQLDF: </p>
  
  <pre><code>dp1 &lt;- sqldf("select Date, 
                       Comments,
                       SUM(BuysToForecast) AS 'SUM' from dp")
  
  head(dp1)(example data): 
  
         Date Comments     SUM
  1 5/30/2018 Approved 2062046
  </code></pre>
  
  <p>apologies ahead of time for any formatting issues - very new to R</p>