tor*_*ino 1 r sum cumulative-sum
I'm trying to get cumulative sums for the previous row/year. Running cumsum(data$fonds) gives me the running totals of adjacent sells, which doesn't work for what I want to do. I would like to have my data look like the following:
year fond cumsum
1 1950 0 0
2 1951 1 0
3 1952 3 1
4 1953 0 4
5 1954 0 4
Run Code Online (Sandbox Code Playgroud)
Any help would be appreciated.