Normally one uses POSIXct rather than POSIXlt for storage. See R News 4/1 for more info on date and time classes.
On Feb 17, 2008 3:45 PM, Bo Zhou <[EMAIL PROTECTED]> wrote: > > Hi Guys, > > I'm cooking up my time series code. I want a data frame with first column as > timestamp in POSIXlt format. > > I hit on this the problem of how to create an array/list/vector of POSIXlt > objects. Code is as follows > > > > > dtt=array(dim = 2) > > t=as.POSIXlt( strptime("07/12/07 13:20:01", "%m/%d/%Y %H:%M:%S",tz="GMT")) > > dtt > [1] NA NA > > t > [1] "0007-07-12 13:20:01 GMT" > > dtt[1]=t > Warning message: > In dtt[1] = t : > number of items to replace is not a multiple of replacement length > > class(dtt) > [1] "list" > > class(t) > [1] "POSIXt" "POSIXlt" > > unclass(t) > $sec > [1] 1 > > $min > [1] 20 > > $hour > [1] 13 > > $mday > [1] 12 > > $mon > [1] 6 > > $year > [1] -1893 > > $wday > [1] 4 > > $yday > [1] 192 > > $isdst > [1] 0 > > attr(,"tzone") > [1] "GMT" > > > > Seems like POSIXlt is matrix in this case. > > Any suggestions? > > Cheers, > > B > _________________________________________________________________ > [[elided Hotmail spam]] > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. > ______________________________________________ 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.