Hourly sequence in R

I am trying to create a date sequence with hourly intervals. As an example, I tried the following:

> seq(as.Date("1912-02-24 23:00:00"), as.Date("1912-02-25 08:32:00"), by="hour") 

which causes an error but works fine: year, month, day.

The documentation for seq.POSIXt {base} states that it should work for hours, seconds, minutes, etc., but all of them lead to an error.

 > ?seq.POSIXt 

Thanks in advance.

+7
source share
1 answer

Well, do not give an answer to yourself :-)

What about:

 seq(as.POSIXct("1912-02-24 23:00:00"), as.POSIXct("1912-02-25 08:32:00"), by="hour") 

(also works with as.POSIXlt ).

+13
source

All Articles