title: Summing specific rows and adding it to matched rows as a new attribute wtithout using function or any loops in R
body: <p>My dataset sample is as follows: </p>
  
  <pre><code>df1 &lt;- data.frame(v1 = c(1,1,1,4,5,5,4,1,2,3,5,6,2,1,5), 
                 v2 = c(11,13,3,42,15,25,44,13,21,73,65,26,52,11,57))
   df2 &lt;- data.frame(v3 = c(1,2,3,0,4,5,6,7))
   df2$newCol = 0
  </code></pre>
  
  <p>I want to do following pseudo code without using function or any loops (library function can be use). Because the dataset is very long (50k rows) and processing common codes is takes long time).</p>
  
  <pre><code>for i to length(df2$v3)
      for j to length(df1$v1)
         if (df2$v3[i] == df1$v1[j])
             df2$newCol[i] = df2$newCol[i] + df$v2[j]
  </code></pre>