Displaying 1 result from an estimated 1 matches for "secep".
Did you mean:
recep
2011 Jan 10
2
Aggragating subsets of data in larger vector with sapply
Have 40,000 rows of buy/sell trade data and am trying to add up the buys for
each second, the code works but it is very slow. Any suggestions how to
improve the sapply function ?
secEP = endpoints(xSym$Direction, "secs") # vector of last second on an XTS
timeseries object with multiple entries for each second.
d = xSym$Direction
s = xSym$Size
buySize = sapply(1:(length(secEP)-1), function(y) {
i = (secEP[y]+ 1):secEP[y+1]; # index of vectors between each secEP
retu...