I have the following OHLC data (by 3-minute intervals)
library(tseries)
library(xts)
library(quantmod)
> str(tickmin)
An ‘xts’ object from 2010-06-30 15:47:00 to 2010-09-08 15:14:00 containing:
Data: num [1:8776, 1:5] 9215 9220 9205 9195 9195 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:5] "zv.Open" "zv.High" "zv.Low" "zv.Close" ...
Indexed by objects of class: [POSIXct,POSIXt] TZ:
xts Attributes:
NULL
>tickmin
2010-09-08 15:02:00 20
2010-09-08 15:04:00 77
2010-09-08 15:08:00 86
2010-09-08 15:11:00 7
2010-09-08 15:14:00 43
> start(tickmin)
[1] "2010-06-30 15:47:00 EDT"
> end(tickmin)
[1] "2010-09-08 15:14:00 EDT"
I am trying to aggregate it using the following:
> by <-timeSequence(from = start(tickmin), to = end(tickmin), format="%Y-%m-%d %H%M", by = "day")
>by
[61] [2010-08-29 19:47:00] [2010-08-30 19:47:00] [2010-08-31 19:47:00]
[64] [2010-09-01 19:47:00] [2010-09-02 19:47:00] [2010-09-03 19:47:00]
[67] [2010-09-04 19:47:00] [2010-09-05 19:47:00] [2010-09-06 19:47:00]
[70] [2010-09-07 19:47:00]
> aggregate(Vo(tickmin),by,sum)
Error: length(time(x)) == length(by[[1]]) is not TRUE
..would appreciate any suggestions on how I can fix the error.
str(tickmin)
shows an xts object with 5 columns, yettickmin
only has one column when you print it on the next line. ThetimeSequence
function does not exist in any of the 3 packages you list. – Joshua Ulrich