group.reduce
follows a similar pattern to the JS built-in Array.reduce with the first argument of the callback being the previous value and the second argument being the current value.
So, p
is the value returned by the previous invocation (or the value returned from init in first iteration) and c
is the current value for the row being operated on.