title: How to convert a data.frame to a xts in R?
body: <p>guys!</p>
  
  <p>I need to use the function Return.calculate(), in my dataframe, but to use this function, first of all, <strong>I need to convert my dataframe to xts</strong>.</p>
  
  <p>This is my dataframe:</p>
  
  <pre><code>head(df)
  
       datas preco ticker empresa
  1 20180102 32.09  BBAS3  BRASIL
  2 20180103 33.10  BBAS3  BRASIL
  3 20180104 33.52  BBAS3  BRASIL
  4 20180105 33.70  BBAS3  BRASIL
  5 20180108 33.64  BBAS3  BRASIL
  6 20180109 33.59  BBAS3  BRASIL
  </code></pre>
  
  <p>When I try to convert my dataframe to xts using as.xts() or xts() I receive the following messages:</p>
  
  <p>using as.xts():</p>
  
  <pre><code>Error in as.POSIXlt.character(x, tz, ...) : 
    character string is not in a standard unambiguous format
  </code></pre>
  
  <p>using xts()</p>
  
  <pre><code>Error in xts(z) : order.by requires an appropriate time-based object
  </code></pre>
  
  <p>What can I do to transform my dataframe in a xts object?</p>
  
  <p>Many thanks</p>