title: data.frame Group By column
body: <p>I have a data frame DF.</p>
  
  <p>Say DF is:</p>
  
  <pre><code>  A B
  1 1 2
  2 1 3
  3 2 3
  4 3 5
  5 3 6 
  </code></pre>
  
  <p>Now I want to combine together the rows by the column A and to have the sum of the column B.</p>
  
  <p>For example:</p>
  
  <pre><code>  A B
  1 1 5
  2 2 3
  3 3 11
  </code></pre>
  
  <p>I am doing this currently using an SQL query with the sqldf function. But for some reason it is very slow. Is there any more convenient way to do that? I could do it manually too using a for loop but it is again slow. My SQL query is " Select A,Count(B) from DF group by A". </p>
  
  <p>In general whenever I don't use vectorized operations and I use for loops the performance is extremely slow even for single procedures.</p>