From jeff.horner at vanderbilt.edu  Wed Feb 21 23:23:46 2007
From: jeff.horner at vanderbilt.edu (Jeffrey Horner)
Date: Wed, 21 Feb 2007 16:23:46 -0600
Subject: [Rd] Adding difftime objects to POSIXt objects
Message-ID: <45DCC672.8070807@vanderbilt.edu>

Hello,

?DateTimeClasses states that "one can add or subtract a number of 
seconds or a 'difftime' object from a date-time object, but not add two 
date-time objects."

So, is the below expected behavior?

 > x <- Sys.time()
 > x
[1] "2007-02-21 16:19:56 CST"
 > x + as.difftime("1","%H")
[1] "2007-02-21 16:19:57 CST"
Warning message:
Incompatible methods ("+.POSIXt", "Ops.difftime") for "+"

"+.POSIXt" does behave as expected, though:

 > "+.POSIXt"(x,as.difftime("1","%H"))
[1] "2007-02-21 17:19:56 CST"

 > R.version
                _
platform       i686-pc-linux-gnu
arch           i686
os             linux-gnu
system         i686, linux-gnu
status         Under development (unstable)
major          2
minor          5.0
year           2007
month          01
day            07
svn rev        40398
language       R
version.string R version 2.5.0 Under development (unstable) (2007-01-07 
r40398)

Jeff
-- 
http://biostat.mc.vanderbilt.edu/JeffreyHorner



[Rd] Adding difftime objects to POSIXt objects
Jeffrey Horner