Skip to content
Prev 247093 / 398506 Next

Aggragating subsets of data in larger vector with sapply

Hi Chris,

This seems to work on the sample data you provided.

FUN <- function(x) {
  x <- xts(as.numeric(x),index(x))
  period.apply(x, endpoints(x,"secs"), sum)
}
lapply(split.default(xSym$Size,xSym$Direction), FUN)

Best,
--
Joshua Ulrich ?| ?FOSS Trading: www.fosstrading.com
On Sun, Jan 9, 2011 at 6:10 PM, rivercode <aquanyc at gmail.com> wrote: