[R] Odd behaviour of as.POSIXct

Hadley Wickham hadley at rice.edu
Sat Jul 16 19:05:07 CEST 2011


> Also, if we make days a list, the class attributes are kept when looping
> over the list, ie.
>
> days<- list( as.Date( c("2000-01-01", "2000-01-02") ) )

Do you realise that that's a list with length one?

I suspect you want

days <- as.list( as.Date( c("2000-01-01", "2000-01-02") ) )
for (day in days) {
  print(day)
}

Hadley


-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/



More information about the R-help mailing list