
Hello,
 
I have a column with dates in the form %Y-%m-%d %H:%M:%S; I want to substract the line i+1 to the line i and get a numeric result (in seconds for instance).
This is what I did (I take the data from a database):
 
res<- dbSendQuery (con, "SELECT Date_Heure FROM data.meteo ")Time<-fetch(res, n=-1)TimeDifferencetime<-as.numeric(diff(strptime(Time, format='%Y-%m-%d %H:%M:%S')) )
Differencetime
 
The colum Time is ok, I get something like (~20 000 values):
 
...
13199 2008-03-19 03:55:4613200 2008-03-19 04:00:4613201 2008-03-19 04:05:4613202 2008-03-19 04:10:4613203 2008-03-19 04:15:46
...
 
But for Differencetime I get:
numeric(0)
 
Well... I don't see the problem in the code lines I wrote... any ideas??
 
Thanks in advance for your help!
 
Solene 
_________________________________________________________________

[[elided Hotmail spam]]

	[[alternative HTML version deleted]]

