Skip to content
Prev 280078 / 398506 Next

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