From ripley at stats.ox.ac.uk  Wed Dec 12 15:45:21 2007
From: ripley at stats.ox.ac.uk (ripley at stats.ox.ac.uk)
Date: Wed, 12 Dec 2007 15:45:21 +0100 (CET)
Subject: [Rd] Wrong length of POSIXt vectors (PR#10507)
Message-ID: <20071212144521.5DCBC2834620@mail.pubhealth.ku.dk>

It is right: it is a list of length 9.  You even constructed it as such a 
list!

On Tue, 11 Dec 2007, simecek at gmail.com wrote:

> Full_Name: Petr Simecek
> Version: 2.5.1, 2.6.1
> OS: Windows XP
> Submission from: (NULL) (195.113.231.2)
>
>
> Several times I have experienced that a length of a POSIXt vector has not been
> computed right.
>
> Example:
>
> tv<-structure(list(sec = c(50, 0, 55, 12, 2, 0, 37, NA, 17, 3, 31
> ), min = c(1L, 10L, 11L, 15L, 16L, 18L, 18L, NA, 20L, 22L, 22L
> ), hour = c(12L, 12L, 12L, 12L, 12L, 12L, 12L, NA, 12L, 12L,
> 12L), mday = c(13L, 13L, 13L, 13L, 13L, 13L, 13L, NA, 13L, 13L,
> 13L), mon = c(5L, 5L, 5L, 5L, 5L, 5L, 5L, NA, 5L, 5L, 5L), year = c(105L,
> 105L, 105L, 105L, 105L, 105L, 105L, NA, 105L, 105L, 105L), wday = c(1L,
> 1L, 1L, 1L, 1L, 1L, 1L, NA, 1L, 1L, 1L), yday = c(163L, 163L,
> 163L, 163L, 163L, 163L, 163L, NA, 163L, 163L, 163L), isdst = c(1L,
> 1L, 1L, 1L, 1L, 1L, 1L, -1L, 1L, 1L, 1L)), .Names = c("sec",
> "min", "hour", "mday", "mon", "year", "wday", "yday", "isdst"
> ), class = c("POSIXt", "POSIXlt"))
>
> print(tv)
> # print 11 time points (right)
>
> length(tv)
> # returns 9 (wrong)
>
> I have tried that on several computers with/without switching to English 
> locales, i.e. Sys.setlocale("LC_TIME", "en"). I have searched a help 
> pages but I cannot imagine how that could be OK.
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

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



[Rd] Wrong length of POSIXt vectors (PR#10507)
ripley at stats.ox.ac.uk