unlist() list of dates
There are methods of the "c" function for things of class "POSIXlt" and "Date"
so do.call("c", dataList) works instead of unlist:
> dateList <- list(LastWeekend=as.POSIXlt(sprintf("2011-12-%d", 10:11)),
+ Today=as.POSIXlt("2011-12-12"))
> z <- do.call("c", dateList)
> z
LastWeekend1 LastWeekend2 Today
"2011-12-10 PST" "2011-12-11 PST" "2011-12-12 PST"
> str(z)
POSIXlt[1:3], format: "2011-12-10" "2011-12-11" "2011-12-12"
- attr(*, "names")="LastWeekend1" "LastWeekend2" "Today"
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
-----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Ana Sent: Monday, December 12, 2011 9:03 AM To: r-help at r-project.org Subject: [R] unlist() list of dates how can I keep the date info after doing unlist to a list of dates? I have a list of dates were observations were made for each station in each month list.obs[[station]][month] [1] "1979-01-01" "1979-01-10" "1979-01-25" [1] 0 1 2 3 when i try to unlist i loose the date info. what am I doing wrong?
______________________________________________ R-help at 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.