Functional way to reverse cumulative sum?
Just use diff
to get the successive differences:
> c(vec[1],diff(vec))
[1] 1 2 3 4 5 6 7 8 9 10
Just use diff
to get the successive differences:
> c(vec[1],diff(vec))
[1] 1 2 3 4 5 6 7 8 9 10