> diff(1:10) ## diff表示后一个数减去前一个数
# [1] 1 1 1 1 1 1 1 1 1
> diff(1:10,differences = 2) ## differences 参数表示连续执行两次diff
# [1] 0 0 0 0 0 0 0 0
> diff(1:10,lag = 2, differences = 2)
### lag表示中间有两个间距的数只差,比如第三数和第一个数只差,以此类推
# [1] 0 0 0 0 0 0
> diff(1:10, 2) #此时默认是lag
# [1] 2 2 2 2 2 2 2 2