Sequence of time(hour)

datetime, r, sequence, time-series

Solution

Specify the time in full?

seq(
     from=as.POSIXct("2012-1-1 0:00", tz="UTC"),
     to=as.POSIXct("2012-1-3 23:00", tz="UTC"),
     by="hour"
   )  

Problem

I tried: ``` seq( from=as.POSIXct("2012-1-1 0", tz="UTC"), to=as.POSIXct("2012-1-3 23", tz="UTC"), by="hour" ) ``` But I only get 1 hour(0:00:00) of the last day instead of 24 hours, actually any hour of the day resulted in only one hour(0:00:00), and I do want to have 2012-1-4.

Original source