title: Using plyr to match column values in two data frames
body: <p>df</p>
  
  <pre><code>av  bv  tv   u   l value           s
  30 120 360 330 210  6600 0.005238424 
  35 125 360 325 200  6875 0.005028887
  40 130 360 320 190  7150 0.004835468
  45 135 360 315 180  7425 0.004656377
  50 140 360 310 170  7700 0.004490078
  55 145 360 305 160  7975 0.004335247
  60 150 360 300 150  8250 0.004190739
  65 155 360 295 140  8525 0.004055554
  70 160 360 290 130  8800 0.003928818
  75 165 360 285 120  9075 0.003809763
  80 170 360 280 110  9350 0.003697711
  </code></pre>
  
  <p>dput(df)</p>
  
  <pre><code>df&lt;-structure(list(av = c(30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 
  80), bv = c(120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 
  170), tv = c(360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 
  360), u = c(330, 325, 320, 315, 310, 305, 300, 295, 290, 285, 
  280), l = c(210, 200, 190, 180, 170, 160, 150, 140, 130, 120, 
  110), value = c(6600, 6875, 7150, 7425, 7700, 7975, 8250, 8525, 
  8800, 9075, 9350), s = c(0.005238424, 0.00502888704, 0.00483546830769231, 
  0.00465637688888889, 0.00449007771428572, 0.00433524744827586, 
  0.0041907392, 0.00405555406451613, 0.003928818, 0.00380976290909091, 
  0.00369771105882353)), .Names = c("av", "bv", "tv", "u", "l", 
  "value", "s"), row.names = c(1L, 13L, 25L, 37L, 49L, 61L, 73L, 
  85L, 97L, 109L, 121L), class = "data.frame")
  </code></pre>
  
  <p>df2</p>
  
  <pre><code>  av  bv  tv   u  l value
    30 120   0   0  0     0
    30 120  20   0  0     0
    30 120  40  10  0   550
    30 120  60  30  0  1650
    30 120 120  90  0  4950
    30 120 180 150 30  6600
  </code></pre>
  
  <p>dput(df2)</p>
  
  <pre><code>df2&lt;-structure(list(av = c(30, 30, 30, 30, 30, 30), bv = c(120, 120, 
  120, 120, 120, 120), tv = c(0, 20, 40, 60, 120, 180), u = c(0, 
  0, 10, 30, 90, 150), l = c(0, 0, 0, 0, 0, 30), value = c(0, 0,
  550, 1650, 4950, 6600)), .Names = c("av", "bv", "tv", "u", "l", 
  "value"), row.names = c(1L, 2602L, 5203L, 7804L, 10405L, 13006L
  ), class = "data.frame")
  </code></pre>
  
  <p>All I want to do is add the <code>df$s</code> values in <code>df</code> to <code>df2</code> where <code>df$bv == df2$bv</code>. <code>df2</code> will have a lot more of the same <code>bv</code> values in <code>df</code>, so there will be some repetitive <code>s</code> values.</p>
  
  <p>I was trying the following</p>
  
  <pre><code>     newDF &lt;- ddply(df2, .(bv,tv), summarise, s = df[df$bv %in% df2$bv,]$s)
  </code></pre>
  
  <p>Although this is not working for me, maybe it's because I don't really understand the variable arguments in this function.</p>
  
  <p>Really all other columns are arbitrary at this point, but I would like to keep the entire dataframe intact.</p>