If you have a column labelled Volume, to.period will sum it: e.g.,
library(xts)
data(sample_matrix)
s - as.xts(sample_matrix)
s - cbind(s, Volume = round(exp(runif(NROW(s),2,3))*1))
head(s)
head(to.weekly(s))
Cheers,
Michael
On Sat, Sep 15, 2012 at 4:57 PM, Costas Vorlow
You can use `period.apply` (along with `endpoints()`) to apply any
function you like over non-overlapping time periods.
In this case, you want to sum columns 2 and 3 separately, so use
`period.apply()` with `FUN=colSums` on just the 2nd and 3rd columns.
period.apply(test[, 2:3],
?period.sum
HTH
Jeff
Jeffrey Ryan|Founder|jeffrey.r...@lemnica.com
www.lemnica.com
On Sep 15, 2012, at 10:57 AM, Costas Vorlow costas.vor...@gmail.com wrote:
Hello,
I have the following data (xts) (last two columns refer to up and down
volumes).
head(test,20)