[R] ISOdatetime gives NA for a specific date

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Feb 10 16:19:34 CET 2009


On Tue, 10 Feb 2009, pbarros wrote:

>
> Hi all,
>
> I am using ISOdatetime, and I just found out that when I do
> ISOdatetime(1995,03,26,2,10,0) (or any other value under minutes or seconds)
> I get NA
>
> This does not happen with the same time in other dates, nor with different
> hours in the same date.
> Any hint why this happens?

A non-existent time, most likely:

  x <- ISOdatetime(1995,03,26,1,10,0)
> x
[1] "1995-03-26 01:10:00 CET"
> seq(x, length=10, by="hour")
  [1] "1995-03-26 01:10:00 CET"  "1995-03-26 03:10:00 CEST"
  [3] "1995-03-26 04:10:00 CEST" "1995-03-26 05:10:00 CEST"
  [5] "1995-03-26 06:10:00 CEST" "1995-03-26 07:10:00 CEST"
  [7] "1995-03-26 08:10:00 CEST" "1995-03-26 09:10:00 CEST"
  [9] "1995-03-26 10:10:00 CEST" "1995-03-26 11:10:00 CEST"

in TZ=Europe/Lisbon, which is my guess as to near where you are

There was no 2:10 on 1995-03-26 in Lisbon: the clocks went forward an 
hour at 2 am.

> Using R 2.8.1 under ESS/GnuEmacs under Windows XP
>
> Pedro


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