Skip to content
Prev 170598 / 398506 Next

How to create sequence of constant time interval

Dear R-Experts, 

seek your help.

There are two parts I want to deal with.
1) 
I want to create a time interval of say, 30 minutes starting from "00:00:00"
hrs
Thus at the end, I want to create sequence:
00:00:00
00:30:00
01:00:00 
01:30:00
..
..
How to do so ?
Later, I want to change the time-increment value in a variable and changing
the value of this variable, I would like to create new sequence with that
time increment. How to use "seq()" correctly?

2)
I have a date stored in one variable. Say "2009-01-01"
How can I combine this date with each time interval in the first part? Will
concatenate work?
so at the end, I would like to have:

2009-01-01 00:00:00
2009-01-01 00:30:00
2009-01-01 01:00:00
2009-01-01 01:30:00
...
...

Thank you in advance.