title: R ifelse avoiding change in date format
body: <p>I am trying to make ifesle for two dates. I have two columns- DateIn and DateOut. I need to add 3rd variable, which would show "DateOut" if there is date value, or DateIn if there is :</p>
  
  <pre><code>DateIn     DateOut     Travel date
  2010-11-24 &lt;NA&gt;        2010-11-24
  2011-12-21 2012-01-21  2012-01-21
  2010-10-25 2010-11-25  2010-11-25
  2014-01-14 &lt;NA&gt;        2014-01-14
  </code></pre>
  
  <p>I tried to do that with</p>
  
  <pre><code>TravelDate &lt;- ifelse(is.na(DateIn), DateOut, DateIn)
  </code></pre>
  
  <p>But the result I am gettin is:</p>
  
  <pre><code>    DateIn     DateOut     Travel date
  2010-11-24 &lt;NA&gt;            15018
  2011-12-21 2012-01-21      15151
  2010-10-25 2010-11-25      14972
  2014-01-14 &lt;NA&gt;            14972
  </code></pre>
  
  <p>Travel date is classified as "logical"
  Is there a ways how to achieve the rusult withou R transforming date to number?</p>
  
  <p>Thanks a lot!</p>