[R] Does POSIXlt extract date components properly?

2011-03-01 Thread Seth W Bigelow
I would like to use POSIX classes to store dates and extract components of dates. Following the example in Spector (Data Manipulation in R), I create a date mydate = as. POSIXlt('2005-4-19 7:01:00') I then successfully extract the day with the command mydate$day [1] 19 But when I try to

Re: [R] Does POSIXlt extract date components properly?

2011-03-01 Thread Luke Miller
Month counts from 0 in POSIXlt objects, so that April is month 3 in your example, January being month 0. Year counts from 1900 in POSIXlt objects, so that 2005 should return as 105 in your example. All of the other fields in POSIXlt should return values that you might expect them to a priori.

Re: [R] Does POSIXlt extract date components properly?

2011-03-01 Thread Prof Brian Ripley
On Tue, 1 Mar 2011, Seth W Bigelow wrote: I would like to use POSIX classes to store dates and extract components of dates. Following the example in Spector (Data Manipulation in R), I create a date mydate = as. POSIXlt('2005-4-19 7:01:00') I then successfully extract the day with the