Created
May 22, 2014 21:48
-
-
Save mmparker/33ba6e2af02ae21d9246 to your computer and use it in GitHub Desktop.
Successive pairwise date diffs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(zoo) | |
| # Some sequence of Dates | |
| x <- as.Date("2014-01-01") + c(0, 1, 2, 5, 10) | |
| data.frame(x, | |
| basediff = c(NA, diff(x)), | |
| mpdiff = c(NA, x[-1] - x[-length(x)]) | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment