cumsuminv {lazy.tools} | R Documentation |
Inverse of Cummurative Sum
cumsuminv(x)
x |
A numeric vector |
This function returns lagged difference of lagg=1 and x[1] as:
c( x[1], diff(x,1) )
A vector of the inverse of cumsum.
set.seed(1701)
x=sample(1:9,9,replace=1)
y=cumsum(x)
Print(x,y,cumsuminv(y))