From jorismeys at gmail.com  Mon Aug  8 00:26:03 2011
From: jorismeys at gmail.com (Joris Meys)
Date: Mon, 8 Aug 2011 00:26:03 +0200
Subject: [Rd] all.equal doesn't work for POSIXlt objects
Message-ID: <CAO1zAVauL433-rOyNR6Y-9b+e8YOowL2MoRFZ+3aj1fiZjbHEw@mail.gmail.com>

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



[Rd] all.equal doesn't work for POSIXlt objects
Joris Meys