title: R: data.frame to xts object: inadvertent conversion of numerical data to strings
body: <p>I am trying different ways to convert a data.frame to an xts time series. My current attempt gives me a result that I don't quite understand; I'd like to know why.</p>
  
  <pre><code>RX1 &lt;- read.csv("RX1.csv")
  RX1=setNames(RX1, c("Date", "PX_LAST"))
  RX1 &lt;- RX1[-1,] #just getting rid of first row as data not valid
  RX1$Date &lt;- as.Date(as.character(RX1$Date), format="%m/%d/%Y")
  </code></pre>
  
  <p>Now we should be good to go as we have the following data.frame</p>
  
  <pre><code>         Date PX_LAST
  2 2006-07-26   89.57
  3 2006-07-27   89.86
  4 2006-07-28   90.15
  5 2006-07-31   90.17
  6 2006-08-01   90.06
  7 2006-08-02   90.04
  
  RX1.ts &lt;- xts(RX1$PX_LAST, order.by = RX1$Date)
  </code></pre>
  
  <p>The result is</p>
  
  <pre><code>2006-07-26 "89.57"
  2006-07-27 "89.86"
  2006-07-28 "90.15"
  2006-07-31 "90.17"
  2006-08-01 "90.06"
  2006-08-02 "90.04"
  </code></pre>
  
  <p>Can somebody help me understand what I did that caused the conversion of the price to characters ?</p>