title: Calculate average of month and replace values of other column
body: <p>I have a dataframe as given below:</p>
  
  <pre><code>vdate=c("12-04-2015","13-04-2015","14-04-2015","15-04-2015","12-05-2015","13-05-2015","14-05-2015"
      ,"15-05-2015","12-06-2015","13-06-2015","14-06-2015","15-06-2015")
  month=c(4,4,4,4,5,5,5,5,6,6,6,6)
  col1=c(12,12.4,14.3,3,5.3,1.8,7.6,4.5,7.6,10.7,12,15.7)
  
  df=data.frame(vdate,month,col1)
  </code></pre>
  
  <p>Below is the column which contains value based on some calculation:</p>
  
  <pre><code>pvar=c(8.4,2.4,12,14.4,2.3,3.5,7.8,5,16,5.4,18,18.4)
  </code></pre>
  
  <p><strong>Now I want to replace pvar value if its value less than the average value for that particular month.</strong></p>
  
  <pre><code>For example,
  for month 4,
  Average value of pvar is 9.3 ((8.4+2.4+12+14.4)/4).
  </code></pre>
  
  <p><strong>Then replace all the value in pvar which is less than avg for month 4 that is (8.4 &amp;2.4).</strong>
      Pvar value would be 9.3,9.3,12,14.4</p>
  
  <p>I need to do this for all the values in pvar.</p>