[R] Convert numeric value to POSIXct

Matt Pocernich pocernic at rap.ucar.edu
Wed Jan 22 23:56:03 CET 2003


Hi,

How do I convert a numeric value indicating the time since 1970, back into
a POSIXct class object?  I have tried format.POSIXct and as.POSIXct
without success.

For example
> ccc
[1] "1945-01-01 15:00:00 MDT"
> ddd<- as.numeric(ccc);
> ddd
[1] -788842800
> format.POSIXct(ddd)
Error in format.POSIXct(ddd) : wrong class
> as.POSIXct(ddd)
Error in as.POSIXct.default(ddd) : Don't know how to convert `ddd' to
class "POSIXct"
>

Thanks,

Matt

Matt Pocernich
NCAR - Research Applications Program
303-497-8312




More information about the R-help mailing list