title: Converting an XTS object to a data.frame
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/11427434/how-to-create-a-variable-of-rownames">How to create a variable of rownames?</a>  </p>
  </blockquote>
  
  
  
  <hr>
  
  <p>Please run it in  R:</p>
  
  <pre><code>require(quantmod)   
  setSymbolLookup(SDB=list(name="000001.sz",src="yahoo"))   
  getSymbols("SDB",from="2010-01-01",to="2010-02-01")   
  sdb=as.data.frame(weeklyReturn(SDB))  
  sdb    
  </code></pre>
  
  <p>What I get is:</p>
  
  <pre><code>           weekly.returns             
  2010-01-08    -0.07830343          
  2010-01-15    -0.05176991              
  2010-01-22     0.07699487              
  2010-01-29    -0.05979203         
  2010-02-01    -0.02119816 
  </code></pre>
  
  <p>What I want to get is:</p>
  
  <pre><code>        date  weekly.returns                   
  1 2010-01-08     -0.07830343           
  2 2010-01-15     -0.05176991         
  3 2010-01-22      0.07699487          
  4 2010-01-29     -0.05979203            
  5 2010-02-01     -0.02119816 
  </code></pre>
  
  <p>How can I do this?</p>
  
  <p>Note that this is an <code>XTS</code> object, not a basic <code>data.frame</code>. After the conversion, I want the original rownames to appear as a new variable in the resulting <code>data.frame</code>.</p>