title: Converting factor in different formats to date in R
body: <p>I have a dataframe <code>data2</code> with a variable <code>x.date</code> in different formats:</p>
  <pre><code>[1] &quot;42250&quot;      &quot;14/03/2015&quot; &quot;14/03/2015&quot; &quot;42311&quot;     
     [5] &quot;42158&quot;      &quot;42158&quot;      &quot;19/03/2015&quot; &quot;19/03/2015&quot;
     [9] &quot;19/03/2015&quot; &quot;19/03/2015&quot; &quot;19/03/2015&quot; &quot;18/03/2015&quot;
  </code></pre>
  <p>I need to convert it to dd/mm/yyyy format, if I try the following:</p>
  <pre><code>as.Date(data2$x.date format = &quot;%m/%d/%Y&quot;)
  </code></pre>
  <p>I receive NAs:</p>
  <pre><code>[1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
    [20] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
  </code></pre>
  <p>What could be a solution to this?</p>