title: Convert SQL statement into R code
body: <p>I need to apply following SQL code into R.</p>
  
  <pre><code>SELECT col1, col2, col3, col4, col5, COUNT(1) AS newcol, 
  SUM(othercol) AS newcol2, SUM(othercol*othercol2) AS newcol3 FROM df;
  GROUP BY col1, col2, col3, col4, col5;
  WHERE 'some conditions'
  </code></pre>
  
  <p>I understand how <code>SELECT</code>, <code>GROUP BY</code>, <code>COUNT(1)</code>, <code>SUM()</code> and <code>AS()</code> works  individually but not as a whole like in the code above, mainly how <code>COUNT(1)</code> and <code>SUM()</code> are working.</p>