R ifelse avoiding change in date format [duplicate]
问题 This question already has answers here : How to prevent ifelse() from turning Date objects into numeric objects (6 answers) Closed 4 years ago . 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 : DateIn DateOut Travel date 2010-11-24 <NA> 2010-11-24 2011-12-21 2012-01-21 2012-01-21 2010-10-25 2010-11-25 2010-11-25 2014-01-14 <NA> 2014-01-14 I tried to do that