[R] strptime

About this list Date view Thread view Subject view Author view Attachment view

From: David Scott (d.scott@auckland.ac.nz)
Date: Thu 06 May 2004 - 12:00:25 EST


Message-id: <Pine.LNX.4.44.0405061347520.8584-100000@stat71.stat.auckland.ac.nz>


Delving into the murky world of dates and times I found this:

dates <- c("02/27/92", "02/27/92", "01/14/92", "02/28/92", "02/01/92")
> times <- c("23:03:20", "22:29:56", "01:03:30", "18:21:03", "16:56:26")
> x <- paste(dates, times)
> z <- strptime(x, "%m/%d/%y %H:%M:%S")
> z
[1] "1992-02-27 23:03:20" "1992-02-27 22:29:56" "1992-01-14 01:03:30"
[4] "1992-02-28 18:21:03" "1992-02-01 16:56:26"

which I understand. But then

> length(dates)
[1] 5
> length(times)
[1] 5
> length(z)
[1] 9
>

which I don't.

It seems that length of a POSIXlt vector (which z is), always returns 9.

David Scott

PS: Using 1.9.0 on linux

_________________________________________________________________
David Scott Department of Statistics, Tamaki Campus
                The University of Auckland, PB 92019
                Auckland NEW ZEALAND
Phone: +64 9 373 7599 ext 86830 Fax: +64 9 373 7000
Email: d.scott@auckland.ac.nz

Graduate Officer, Department of Statistics

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Mon 31 May 2004 - 23:05:07 EST