An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090413/281b00ad/attachment-0001.pl>
value of strptime in R 1.8.0
2 messages · Mitra Jazayeri, David Winsemius
Mitra;
n Apr 12, 2009, at 8:09 PM, Mitra Jazayeri wrote:
Dear R friends, I have a data frame, I need to get a time interval between the two columns. The times are recorded in 24 hour clock. My data frame is called version.one. my commands are: t.s.one<-paste(version.one[,9]) t.s.two<-paste(version.one[,61]) x<-strptime(t.s.one,format="%H:%M") x y<-strptime(t.s.two ,format="%H:%M") y z<-difftime(y,x, units = "mins") z But now in my z object i have negative numbers. Would you please let me know why?
Given that neither version.one[,9] nor version[,61] is available to us, how can readers of this be expected to answer other than with the trivial hypothesis that t.s.one is after t.s.two?
And how can I get rid of this problem?
Change the order of the calculation? (You cannot use abs, since that function is not defined for difftime objects.)
David Winsemius, MD Heritage Laboratories West Hartford, CT