From Kurt.Hornik at wu.ac.at  Mon Aug  8 08:07:23 2011
From: Kurt.Hornik at wu.ac.at (Kurt Hornik)
Date: Mon, 8 Aug 2011 08:07:23 +0200
Subject: [Rd] all.equal doesn't work for POSIXlt objects
In-Reply-To: <CAO1zAVauL433-rOyNR6Y-9b+e8YOowL2MoRFZ+3aj1fiZjbHEw@mail.gmail.com>
References: <CAO1zAVauL433-rOyNR6Y-9b+e8YOowL2MoRFZ+3aj1fiZjbHEw@mail.gmail.com>
Message-ID: <20031.32027.537956.411788@fangorn.hornik.net>

>>>>> Joris Meys writes:

This is already fixed in r-devel.

-k

> Hi all,
> following sample code illustrates the problem :

>   Date1 <- Date2 <-
> as.POSIXlt(seq.Date(as.Date("2010-04-01"),as.Date("2011-04-01"),by='day'))
>   identical(Date1,Date2)
>   all.equal(Date1,Date2)

> identical() gives the correct answer. As there is no all.equal method
> for POSIXlt objects, all.equal.list is used instead. Subsetting using
> [[]] doesn't work on POSIXlt objects. I solved the problem by adding a
> function all.equal.POSIXlt() :

> all.equal.POSIXlt <- function(target, current, ..., scale=1) {
>   check_tzones(target, current)
>   target <- unclass(target)
>   current <- unclass(current)
>   NextMethod("all.equal.list")
> }

> This seems to work bugfree, but I'm not sure about it. So am I doing
> it correct, and if so, can this be added to the next R release? I'm
> not sure where else I should drop this proposal...

> Cheers
> Joris

> -- 
> Joris Meys
> Statistical consultant

> Ghent University
> Faculty of Bioscience Engineering
> Department of Applied mathematics, biometrics and process control

> tel : +32 9 264 59 87
> Joris.Meys at Ugent.be
> -------------------------------
> Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] all.equal doesn't work for POSIXlt objects
Kurt Hornik