title: Calculate average sales using criteria from one dataframe and aggregating in other data frame
body: <p>I have <code>df1$NextBizDay</code> which has dates.
  Other dataframe <code>df2</code> has two columns <code>df2$Date</code> and <code>df2$Sales</code></p>
  
  <p>Now I am trying to calculate average sales using dates from <code>df1$NextBizDay</code>. As <code>df1$NextBizDay</code> can have duplicate dates I calculated the frequency of each date using <code>as.data.frame(table(df1$NextBizDay))[,2]</code></p>
  
  <p>Now I need to sum and divide so that I can get average sales.</p>
  
  <p>I know <code>aggregate(Sales~Date,df2,sum)[,2]</code> will give me total sales for each date but I am not sure how to proceed further. </p>
  
  <blockquote>
    <p>Example input:         </p>
  </blockquote>
  
  <pre><code>    df1$NextBizday  
      2018-10-22  
      2018-10-22  
      2018-10-23  
      2018-10-23  
      2018-10-23  
      2018-10-24  
  
  
      df2$Date    df2$Sales
      2018-10-22  1000
      2018-10-23  2000
      2018-10-24  3000
      2018-10-25  4000
      2018-10-26  5000
      2018-10-27  6000
  </code></pre>
  
  <blockquote>
    <p>Expected output   df1</p>
  </blockquote>
  
  <pre><code>    NextBizday AvgSales
      2018-10-22  500
      2018-10-22  500
      2018-10-23  666.6666667
      2018-10-23  666.6666667
      2018-10-23  666.6666667
      2018-10-24  3000
  </code></pre>
  
  <p>basically what I am trying to do is lookup each date from df1 in df2 and divide sales by the frequency of date in df1.</p>