Re: [R] DateDiff

2010-10-06 Thread Dennis Murphy
Hi: Here's a toy example: dat <- seq(as.Date('1990/05/01'), to = as.Date('1990/12/01'), by = 'week') ddf <- data.frame(datBegin = dat[-length(dat)], datEnd = dat[-1]) ddf <- transform(ddf, datDiff = datEnd - datBegin) Alternatively, if you don't want the data frame route, datDiff <- diff(dat) l

Re: [R] DateDiff

2010-10-06 Thread David Winsemius
On Oct 6, 2010, at 11:07 PM, Santosh Srinivas wrote: Dear List, I have a column of dates say: test$date1 <- seq(19900511, to = 19900521) Those aren't dates. (but if they were the methods should be the same) I want the next column to have the number of days between each subsequent date

[R] DateDiff

2010-10-06 Thread Santosh Srinivas
Dear List, I have a column of dates say: test$date1 <- seq(19900511, to = 19900521) I want the next column to have the number of days between each subsequent date i.e days between r(i+1) and r(i) Any easy way to do this? (I've done it in a roundabout way but just wondering if there is any way m