Re: [R] Problem with diff(strptime(...

2008-03-21 Thread Jim Lemon
I think I have worked out the problem, and because it may trouble others, I take the liberty of explaining it on the mailing list. When diff is applied to a vector of POSIXt values returned by strptime, the units depend upon the smallest interval in the input vector. If that interval is less th

Re: [R] Problem with diff(strptime(...

2008-03-20 Thread Jim Lemon
Prof Brian Ripley wrote: > You are throwing away the clue in your use of as.numeric. > > First. strptime returns a POSIXlt value, which you will convert to > POSIXct when you do arithetic (using diff()). Why are you doing that? So > >> foodate<-factor(c("1/7/1991","1/8/1991","1/8/1991","3/8/19

Re: [R] Problem with diff(strptime(...

2008-03-20 Thread Prof Brian Ripley
You are throwing away the clue in your use of as.numeric. First. strptime returns a POSIXlt value, which you will convert to POSIXct when you do arithetic (using diff()). Why are you doing that? So > foodate<-factor(c("1/7/1991","1/8/1991","1/8/1991","3/8/1991")) > diff(strptime(foodate,"%d/%m