.BG
.FN diff
.TL
Create a Differenced Series
.CS
diff(x, lag=1, differences=1)
.AG x
a time-series or vector.  Missing values (`NA's) are allowed.
.AG lag
the lag of the difference to be computed.
.AG differences
the number of differences to be done.
.PP
.RT
a time-series which is the `differences'th difference of lag `lag' for `x'.
If `y <- diff(x,k)', `y[i]' is `x[i+k]-x[i]',
and `length(y)' is `length(x)-k'.
To construct an `n'th difference, this procedure is iterated `n' times.
Any operation on an `NA' produces an `NA'.
.EX
# second difference of lag 1:
# the start date of d2x will be 2
# periods later than x
d2x <- diff(x,1,2)

diff(range(x))  # max(x) \- min(x)
.KW ts
.KW math
.WR
