I need to apply following SQL code into R.
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'
I understand how SELECT, GROUP BY, COUNT(1), SUM() and AS() works individually but not as a whole like in the code above, mainly how COUNT(1) and SUM() are working.