Read the docs. POSIXlt is a list of 9 elements. Each element length is what you think it should be returning. That is not correct.
?POSIXlt Details: There are two basic classes of date/times. Class '"POSIXct"' represents the (signed) number of seconds since the beginning of 1970 as a numeric vector. Class '"POSIXlt"' is a named list of vectors representing > unclass(as.POSIXlt(as.POSIXlt('2007-01-01')+1:11)) $sec [1] 1 2 3 4 5 6 7 8 9 10 11 $min [1] 0 0 0 0 0 0 0 0 0 0 0 $hour [1] 0 0 0 0 0 0 0 0 0 0 0 $mday [1] 1 1 1 1 1 1 1 1 1 1 1 $mon [1] 0 0 0 0 0 0 0 0 0 0 0 $year [1] 107 107 107 107 107 107 107 107 107 107 107 $wday [1] 1 1 1 1 1 1 1 1 1 1 1 $yday [1] 0 0 0 0 0 0 0 0 0 0 0 $isdst [1] 0 0 0 0 0 0 0 0 0 0 0 attr(,"tzone") [1] "" "CST" "CDT" Jeff On Wed, Jan 28, 2009 at 4:15 PM, <twoutop...@gmail.com> wrote: > The length() of a POSIXlt object is given as 9 regardless of the actual > length. For example: > >> make.date.time > function (year=c(2006,2006),month=c(8,8),day=2:5,hour=13,minute=45) > {# convert year, etc., into POSIXlt object > # > d=as.character(make.date(year,month,day)) > t=paste(hour,minute,sep=":") > as.POSIXlt(paste(d,t)) > } >> t=make.date.time() >> t > [1] "2006-08-02 13:45:00" "2006-08-03 13:45:00" "2006-08-04 13:45:00" > [4] "2006-08-05 13:45:00" >> length(t) > [1] 9 >> t[1] > [1] "2006-08-02 13:45:00" >> length(t[1]) > [1] 9 > > > > -- > blog.sethroberts.net > www.shangriladiet.com > boards.shangriladiet.com > cell phone 510 418 7753 (Berkeley) > > [[alternative HTML version deleted]] > > ______________________________________________ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > -- Jeffrey Ryan jeffrey.r...@insightalgo.com ia: insight algorithmics www.insightalgo.com ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel