Skip to content
Prev 5626 / 15274 Next

Rounding time series to nearest 5mn

On Sat, Feb 13, 2010 at 9:07 PM, Kanin Kaninski <kaninski2000 at yahoo.com> wrote:
It performs exactly as documented.  Is that really unfortunate or unexpected?

"Description:

     Change timestamps to the start of the next period, specified in
     multiples of seconds."
[snip]
"Details:

     This function is an S3 generic.  The result is to round up to the
     next period determined by ?n modulo x?."
Make a new xts object:

new.tSerie <- xts(coredata(tSerie),index(tSerie)-1)
align.time(new.tSerie)
                        [,1]
2009-12-15 00:00:00 0.915447
2009-12-15 00:05:00 0.916005
2009-12-15 00:10:00 0.916167
2009-12-15 00:15:00 0.916200
2009-12-15 00:20:00 0.916188
2009-12-15 00:25:00 0.916265

Best,
Josh
--
http://www.fosstrading.com