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
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.