title: How to convert the following data into zoo/xts/tseries object to calculate maximum drawdown?
body: <p>How to convert the following data into zoo/xts/tseries object to calculate maximum drawdown by using the function Return.calculate and Maxdrawdown function?    </p>
  
  <p>Hello friends i have equity(eg CENTURYTEX,AAPL,RIL etc) specific eod prices for around 400 equities in a single csv. </p>
  
  <p>I want to calculate maximum drawdown. To calculate returns i am trying </p>
  
  <pre><code>ret=by[ddr3csv[,4],ddr3csv[,2],
                     function(x)Return.calculate(x,method="simple")]
  </code></pre>
  
  <p>which is giving 'closure' is not subsettable' error. </p>
  
  <p>Once returns are obtained finding maximum drawdown will be easy.I am searching for the error but not able to figure out much.</p>
  
  <pre><code>rownum     name     code       date    price    readings
  
  86916 CENTURYTEX 500040 11/04/2011 364.60     2994
  
  86917 CENTURYTEX 500040 13/04/2011 376.70     2994
  
  86918 CENTURYTEX 500040 15/04/2011 370.90     2994
  
  86919 CENTURYTEX 500040 18/04/2011 365.85     2994
  </code></pre>