[R] "diff"^-1

kjetil@entelnet.bo kjetil at entelnet.bo
Tue Apr 13 21:09:55 CEST 2004


On 13 Apr 2004 at 18:58, michele lux wrote:

> Hallo all
> somebody knows if exist a command who makes the
> opposite of what "diff" command do?
> I'he to write code?
> thanks Michele
> 

As other responses has shown, your Q could have been clearer!

?diffinv

note that this is not really an inverse, as the following shows:

> diffinv(diff(1:10))
 [1] 0 1 2 3 4 5 6 7 8 9

If you know the first element of your original series, you can do:

> diffinv(diff(3:13), xi=3)
 [1]  3  4  5  6  7  8  9 10 11 12 13

Kjetil Halvorsen

> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html




More information about the R-help mailing list