[R] ISOdate returns incorrect date?
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Nov 20 07:58:31 CET 2003
On 20 Nov 2003, Peter Dalgaard wrote:
> Patrick Connolly <p.connolly at hortresearch.co.nz> writes:
>
> > On Wed, 19-Nov-2003 at 05:03PM +0000, Prof Brian Ripley wrote:
> >
> > |> For the record, ISOdate *is* giving the right answer, a POSIXct object.
> > |>
> > |> The problem is in printing, where there was a simple coding bug: is_year
> > |> was applied to the POSIX `year' which is year-1900.
> >
> > I can't see why it doesn't effect dates before 2nd March.
>
> Well, it's an open source program....
>
> 2nd March is day 60 and the code works out month and day by
> subtracting monts as long as the result is positive. If the code
> thinks that there are 29 days in February, then 2nd March becomes the
> 1st, etc.
>
> The thing that puzzles me is that the old code didn't also claim that
> there was a Feb 29 in 1900, and that there wasn't a corresponding issue
> with the year 2000 being a leap year by the %%400 rule. But there
> wasn't and there still isn't...
2000 is in the range your OS knows about: it only affected dates out of
range of the OS's knowledge where some substitute code was used.
--
Brian D. Ripley, ripley at 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
More information about the R-help
mailing list