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 command

mydate$day
[1] 19

But when I try to extract the month

> mydate$mon
[1] 3

it returns the wrong month. And mydate$year is off by about 2,000 years.
Am I doing something wrong?

Not reading the documentation (nor the posting guide). ?DateTimeClasses says

     ‘mon’ 0-11: months after the first of the year.

     ‘year’ years since 1900.

That is the POSIX standard ... you could also have looked there.

Dr. Seth  W. Bigelow
Biologist, USDA-FS Pacific Southwest Research Station
1731 Research Park Drive, Davis California
sbige...@fs.fed.us /  ph. 530 759 1718
        [[alternative HTML version deleted]]

Please note what the posting guide said about that!

______________________________________________
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.


--
Brian D. Ripley,                  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595
______________________________________________
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.

Reply via email to