[ACCEPTED]-Sequence of time(hour)-sequence

Accepted answer
Score: 23

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"
   )  

0

Score: 5

You did not use a standard format for the 1 dates. See ?as.POSIXct.

Try this

seq(from=as.POSIXct("2012-01-01 00:00:00", tz="UTC"), 
    to=as.POSIXct("2012-01-03 23:00:00", tz="UTC"), by="hour")
Score: 5

You could specify a format:

seq(
     from=as.POSIXct("2012-1-1 0","%Y-%m-%d %H", tz="UTC"),
     to=as.POSIXct("2012-1-3 23", "%Y-%m-%d %H", tz="UTC"),
     by="hour"
   )

0

More Related questions