"zoo"
## S3 method for class 'zoo': lag(x, k = 1, \dots) ## S3 method for class 'zoo': diff(x, lag = 1, differences = 1, arithmetic = TRUE, \dots)
k
lag
arithmetic
diff
zoo
x <- zoo(11:21) lag(x, k = 1) lag(x, k = -1) # this pairs each value of x with the next or future value merge(x, lag1 = lag(x, k=1)) diff(x^2)
Run the code above in your browser using DataCamp Workspace