<head><base href="local:///"></head><body data-blackberry-caret-color="#00a8df" style="background-color: rgb(255, 255, 255); line-height: initial;"><div style="width: 100%; font-size: initial; font-family: Calibri, 'Slate Pro', sans-serif; color: rgb(31, 73, 125); text-align: initial; background-color: rgb(255, 255, 255);"><br style="display:initial"></div> <p style="font-size: initial; font-family: Calibri, 'Slate Pro', sans-serif; color: rgb(31, 73, 125); text-align: initial; background-color: rgb(255, 255, 255);">Sent from my BlackBerry 10 smartphone on the Verizon Wireless 4G LTE network.</p> <table width="100%" style="background-color:white;border-spacing:0px;"> <tbody><tr><td colspan="2" style="font-size: initial; text-align: initial; background-color: rgb(255, 255, 255);"> <div id="_persistentHeader" style="border-style: solid none none; border-top-color: rgb(181, 196, 223); border-top-width: 1pt; padding: 3pt 0in 0in; font-family: Tahoma, 'BB Alpha Sans', 'Slate Pro'; font-size: 10pt;"> <div><b>From: </b>Martin Bauer</div><div><b>Sent: </b>Tuesday, May 28, 2013 12:30 AM</div><div><b>To: </b>r-sig-finance@r-project.org</div><div><b>Subject: </b>[R-SIG-Finance] row sum in XTS object</div></div></td></tr></tbody></table><div style="border-style: solid none none; border-top-color: rgb(186, 188, 209); border-top-width: 1pt; font-size: initial; text-align: initial; background-color: rgb(255, 255, 255);"></div><br><div id="_originalContent" style=""><div style="font-family: Verdana;font-size: 12.0px;"><div>Hi,</div>
<div> </div>
<div>here my code</div>
<div> </div>
<div>require(quantmod)<br>
indexes<-c("XLB","XLE","XLF","XLI","XLK","XLP","XLU","XLV","XLY")<br>
getSymbols(indexes)</div>
<div> </div>
<div>p=cbind(Ad(XLB),Ad(XLE),Ad(XLF),Ad(XLI),Ad(XLK),Ad(XLP),Ad(XLU),Ad(XLV),Ad(XLY))</div>
<div> </div>
<div>XLB.CCI=CCI(p[,1],10)<br>
XLE.CCI=CCI(p[,2],15)<br>
XLF.CCI=CCI(p[,3],16)<br>
XLI.CCI=CCI(p[,4],22)<br>
XLK.CCI=CCI(p[,5],28)<br>
XLP.CCI=CCI(p[,6],32)<br>
XLU.CCI=CCI(p[,7],9)<br>
XLV.CCI=CCI(p[,8],6)<br>
XLY.CCI=CCI(p[,9],10)</div>
<div> </div>
<div>p.CCI=cbind(XLB.CCI,XLE.CCI,XLF.CCI,XLI.CCI,XLK.CCI,XLP.CCI,XLU.CCI,XLV.CCI,XLY.CCI)</div>
<div> </div>
<div> </div>
<div>long=lag(p.CCI,k=1)*ROC(p,type="discrete",n=1)</div>
<div>charts.PerformanceSummary(long,ylog=TRUE,main="TEST")</div>
<div> </div>
<div>How can I now sum each column now in the object long, keeping the day and just addsum (p.CCI*ROC)</div>
<div> </div>
<div>Any idea ?</div>
<div> </div>
<div>Many thanks</div></div>
<br></div> <!--end of _originalContent --></body>