Re: [Rd] all.equal doesn't work for POSIXlt objects

From: Kurt Hornik <Kurt.Hornik_at_wu.ac.at>
Date: Mon, 08 Aug 2011 08:07:23 +0200

>>>>> 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@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Mon 08 Aug 2011 - 06:11:44 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 08 Aug 2011 - 10:00:15 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive