```
# NOT RUN {
x <- xts(1:10, Sys.Date()+1:10)
lag(x) # currently using xts-style positive k
# }
# NOT RUN {
<!-- %lagts(x) # same as original lag.xts, to allow for lag.xts to revert to R lag consistency -->
# }
# NOT RUN {
lag(x, k=2)
# }
# NOT RUN {
<!-- %lagts(x, k=2) -->
# }
# NOT RUN {
lag(x, k=-1, na.pad=FALSE) # matches lag.zoo(x, k=1)
diff(x)
diff(x, lag=1)
diff(x, diff=2)
diff(diff(x))
# }
```

Run the code above in your browser using DataLab