Skip to content
Prev 33539 / 63424 Next

Why is strptime always returning a vector of length 9 ?

Thanks.

It seems that the source of my confusion comes from using first using
str() (and then once on the wrong track, it is easier to miss the
information a man page that also describes POSIXct that is itself a
vector of length equal to the number of entries it contains).

With the current example:
POSIXlt[1:9], format: "2007-03-09" "2007-05-31" "2008-11-12"
"2008-11-12" ...

A quick inspection of the output does indicate a something with nine
elements, but the elements appear to be "2007-03-09", "2007-05-31",
etc... possibly creating confusion.

To make it even more confusing I have:
[1] "March 09, 2007"
chr "March 09, 2007"

For what it is worth, I think that the behavior of the extract operator
"[" (defined as a S3 method "[.POSIXlt()") is inconsistent with the
output of length() (default method for lists).


L.
On Sun, 2009-08-09 at 11:45 -0500, Jeff Ryan wrote: