You should not be surprised at any result you obtain by adding an integer to a POSIXlt... that is like adding 5 to 3 meters... 5 whats?

Start by using as.difftime to specify your time units on time intervals. As it happens, the default unit used by POSIXt types is seconds, and POSIXlt is not designed to support arithmetic, so a conversion to POSIXct is performed automatically.

Don't forget that POSIXt handles time zones, including daylight savings, but data rarely includes the timezone in it, so you ought to configure the TZ environment variable before working with the data you have in a POSIXt variable. Many people find it easier to use Date or chron types for simple tasks.

In any case, it is documented, and it is not a bug.
-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

"Buttrey, Samuel (Sam) (CIV)" <buttrey@nps.edu> wrote:

Hi. This feels like a bug to me, or at least an undocumented feature, but I thought I'd see what people here thought of it. Consider a POSIXlt object like this one: > a <- as.POSIXlt ("2011-01-23 12:45:45") > class (a) [1] "POSIXlt" "POSIXt" Fine. Now, if I do some arithmetic on that object, the result is converted to POSIXct. > class (a - 360) [1] "POSIXct" "POSIXt" Does this seem weird? I'm running R 2.12.1 under Windows XP. Thanks, Sam Buttrey 	[[alternative HTML version deleted]]_____________________________________________
R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. 


	[[alternative HTML version deleted]]

