[R] unlist() list of dates
Ana
rrasterr at gmail.com
Mon Dec 12 19:28:00 CET 2011
Thanks!
Another question also related to the same type of files:
How can I transform it into a time series
as.ts()
I also endup having the same problem, the dates are transformed into a
list of numbers
My file looks like this
dates val
1 2001-01-12 1.2
2 2001-02-12 1.2
2 2001-03-12 1.2
(...)
class: data.frame
On Mon, Dec 12, 2011 at 6:30 PM, William Dunlap <wdunlap at tibco.com> wrote:
> 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.
More information about the R-help
mailing list