title: Mean of quartile for multiple columns and multiple dates
body: <p>I'm trying to find the mean forward return (column fwd_rtn) of each quartile for each column (ie for quartiles for PB, PE, PS) for each date group (1/1/2016...1/4/2016)</p>
  
  <pre><code>head(df)
  </code></pre>
  
  <p>Date   Stock Price PB PE PS  fwd_rtn<br>
  1 1/1/2016 A 11.90 0.4    0.10  0.57 -0.015<br>
  2 1/1/2016  B  3.56 0.8    0.09  0.26 -0.036<br>
  3 1/1/2016 C  1.29 1.2    0.18  1.60  0.10<br>
  ......<br>
  4 1/4/2016 A 12.80 0.39    0.13 0.53 -0.01<br>
  5 1/4/2016  B  4.03 0.76    0.08  0.23  0.02<br>
  6 1/4/2016 C  1.83 0.87   0.14  1.16  0.03  </p>
  
  <p>So far i have been able to find the mean return for 1 column for 1 date using this code</p>
  
  <pre><code>df$qPB &lt;- cut(df$PB, breaks = quantile(df$PB, c(0,.25,.5,.75,1)),include.lowest = TRUE)  
  
  aggregate(df$fwd_rtn,list(qPB = df$qPB),FUN=mean)
  </code></pre>
  
  <p>which gave me the right answers. But I'm struggling to do it for the multiple columns. I think I'm supposed to use <code>dplyr</code> and the <code>gather()</code> function but i dont know how.</p>