I have a chron object like this:
t <- as.chron("06/01/13 01:00:00", "%m/%d/%y %H:%M:%S")
and I want to convert it to seconds from origin, where the origin is:
or <- "06/01/13 00:00:00"
so what I want is that the object t become:
t <- 3600
Thank you very much Giulia
Just use
difftime()
:or in the units you want:
As an aside, you probably want to use
POSIXct
instead ofchron
whichdifftime()
converts to for you anyway. Seehelp(DateTimeClasses)
.