Hello - [EMAIL PROTECTED] wrote: > Hello, > > I am an advanced user of R. Recently I found out that apparently I do > not fully understand vectors and lists fully > Take this code snippet: > > > T = c("02.03.2008 12:23", "03.03.2008 05:54") > Times = strptime(T, "%d.%m.%Y %H:%M") > Times # OK > class(Times) # OK > is.list(Times) # sort of understand and not understand that
?POSIXlt says Class '"POSIXlt"' is a named list of vectors representing 'sec' 0-61: seconds 'min' 0-59: minutes 'hour' 0-23: hours 'mday' 1-31: day of the month 'mon' 0-11: months after the first of the year. 'year' Years since 1900. 'wday' 0-6 day of the week, starting on Sunday. 'yday' 0-365: day of the year. 'isdst' Daylight savings time flag. Positive if in force, zero if not, negative if unknown. > length(Times) # 9 ??? why is it length(Times[1]) ?? Because Times is a list with 9 elements, try typing names(Times) to see what those elements are called. That will help you understand. > > Times[1] # OK > Times[[1]] # Wrong Whether or not this is 'wrong' has been I believe debated before on the list. See this message and the rest of the thread associated with it. http://tolstoy.newcastle.edu.au/R/help/06/07/31508.html - Erik Iverson ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.