Cumulative Sum By Group In R. This function takes a vector as an input and I have paneldata, i. T