Re: [R] Mystified - comparing chron times

2011-09-16 Thread MacQueen, Don
Not that anything more needs to be said ... it doesn't, not really ... But I think that in cases like this it is helpful to use the digits arg to print(). It probably would have shown in a simple way that the two numeric versions aren't really equal -- and demonstrated a little about R's default p

Re: [R] Mystified - comparing chron times

2011-09-16 Thread Sarah Goslee
I'll freely admit that I know little about chron and didn't have a computer with R in front of me at the time. But the original querent converted the chron times to numeric and then used ==, and thus it became a 7.31 issue. Converting to character is a different way to approach the problem; which

Re: [R] Mystified - comparing chron times

2011-09-16 Thread David Winsemius
On Sep 16, 2011, at 10:08 AM, B77S wrote: I'm sure Sarah's solution works (and she knows more about R than myself), but I ran into a similar problem and used: as.character(start.time)==as.character(expected_start.time) What you did was an implicit rounding of the values to the digits leve

Re: [R] Mystified - comparing chron times

2011-09-16 Thread B77S
I'm sure Sarah's solution works (and she knows more about R than myself), but I ran into a similar problem and used: as.character(start.time)==as.character(expected_start.time) good luck regardless. -BS Sarah Goslee wrote: > > Sounds like a case for FAQ 7.31, or, yet another machine precision

Re: [R] Mystified - comparing chron times

2011-09-16 Thread Sarah Goslee
Sounds like a case for FAQ 7.31, or, yet another machine precision issue. Try all.equal() instead of == Sarah On Fri, Sep 16, 2011 at 7:36 AM, mebstyne wrote: > I have two local variables: startTime and expectedStartTime.  Both are chron > related objects. > When I look at the class for the obje

[R] Mystified - comparing chron times

2011-09-16 Thread mebstyne
I have two local variables: startTime and expectedStartTime. Both are chron related objects. When I look at the class for the objects I can see they are of class "times". When I print them to the console, they both read: "09:30:00" When I print them as.numeric(), they both read: 0.3958333 When I t