[R] integers to POSIXct

paul sorenson news01 at metrak.com
Wed Oct 4 13:35:09 CEST 2006


What is the recommended way to convert/coerce and integer to a POSIXct 
please?

d <- as.POSIXct(Sys.Date())
i <- as.integer(d)

as.POSIXct(i)
Error in as.POSIXct.default(i) : do not know how to convert 'i' to class 
"POSIXlt"

This appears to be the behaviour in 2.3.1 and 2.4.0 on windows XP.

I have tried searching on this and found as.Date.integer in package zoo 
which performs a similar function but wondered if there was something 
basic I was missing in the base distribution?

cheers



More information about the R-help mailing list