Skip to content
Prev 138656 / 398513 Next

types of vectors / lists

On Mar 5, 2008, at 2:56 PM, a9804814 at unet.univie.ac.at wrote:

            
Far from OK, which is where your misunderstanding starts. Times is a  
POSIXlt object, and behaves as such, not as a vector and not as a  
list. Rather, a bit of both.
The output you see is the result of print(Times), which calls  
print.POSIXlt(Times), which is:

function (x, ...)
{
     print(format(x, usetz = TRUE), ...)
     invisible(x)
}
<environment: namespace:base>


This in turn calls format.POSIXlt(Times), which is pretty complicated  
and I'll omit here, but point is what you see when you type Times is  
not the object TImes itself, but only what the writer of  
print.POSIXlt wants you to see. Similar to the output of lm, which is  
much less than what lm really contains.

Have a look at ?POSIXlt, which says:

Class "POSIXlt" is a named list of vectors representing .... 9  
vectors following.

Try:

names(Times)
Times$sec
Times$min
....

Now perhaps this helps understand the answers?
Not OK at all. This calls [.POSIXlt, look at:

`[.POSIXlt`

In particular, try Times[2], Times[3] etc

Times[[1]] is the same as Times$sec
Times[[2]] is the same as Times$min
and so on.
Haris Skiadas
Department of Mathematics and Computer Science
Hanover College