[R] Problem with all.equal and POSIXt.
Rolf Turner
r.turner at auckland.ac.nz
Mon Sep 13 05:37:50 CEST 2010
On 13/09/2010, at 3:07 PM, Peter Ehlers wrote:
<SNIP>
> I'm not sure that I would call this a bug, but it would seem
> helpful to return an appropriate error message or to coerce to
> POSIXct. Note that
>
> all.equal(as.POSIXct(x), as.POSIXct(x))
>
> yields TRUE, as does using as.Date(x).
Well, I ***would*** call it a bug. The all.equal() function is confusing
the length of x as a POSIXlt object (i.e. the length of its list components)
with the length of the (well hidden) list structure of x (i.e. 9). This is
the wrong thing to do, so it's a bug.
I notice that there is an all.equal.POSIXct() method. Maybe there should also be
an as.equal.POSIXlt() method --- which would just coerce its argument to POSIXct,
and then do NextMethod().
But maybe there's a Good Reason why R Core did not implement an as.equal.POSIXlt()
method --- i.e. it's dangerous to apply all.equa1() to POSIXlt objects.
Can't think why this should be, but.
cheers,
Rolf
######################################################################
Attention:
This e-mail message is privileged and confidential. If you are not the
intended recipient please delete the message and notify the sender.
Any views or opinions presented are solely those of the author.
This e-mail has been scanned and cleared by MailMarshal
www.marshalsoftware.com
######################################################################
More information about the R-help
mailing list