Skip to content
Prev 245768 / 398506 Next

Lost in POSIX

.. One issue with the solution proposed by Jeff is that the transformed
column does not have the original's type:
), class = c("POSIXt", "POSIXct"), tzone = ""), price = c(321, 
323.5), minute = c(1020232860, 1020232860)), .Names = c("time", 
"price", "minute"), row.names = 1:2, class = "data.frame")

minute <- function(t)
{ 
  d <- as.POSIXlt(t, origin = as.Date("1970-01-01")) 
  d$sec <- 0 
  as.POSIXct(d) 
}
time price     minute
1 2002-05-01 07:01:44 321.0 1020232860
2 2002-05-01 07:01:44 323.5 1020232860
[1] "numeric"