Calculate cumulative sum (cumsum) by group in R
In this blog post, I tackle a question that you recurringly see on a lot of boards. We are going to calculate the cumulative sum, but within a group that the rows belong to. Thanks to vegetableagony for pointing out that, depending on the size of the dataset, other conclusions…