title: R: failed to return object
body: <p>After looking at <a href="https://stackoverflow.com/questions/7698797/why-does-mapply-not-return-date-objects">Why does mapply not return date-objects?</a>, I still cannot fix my problem. </p>
  
  <p>The problem: </p>
  
  <p>I have a matrix of date values and I want to convert them to date objects by the following function:</p>
  
  <pre><code>convert_endDate &lt;- function(e){
      d &lt;- paste(e[1], e[2],e[3], sep = "-")
      print(as.Date(strptime(d, format = "%Y-%m-%d")))
      return(as.Date(strptime(d, format = "%Y-%m-%d"))) 
  }
  
  apply(end, 1,convert_endDate)
  </code></pre>
  
  <p>However, it always returns numbers to me:
  <code>[1] 16276 15850 14085 13569 13293 12473 12046 11316 10950 10950</code></p>
  
  <p><strong>Now, how can I convert this to Dates ???</strong></p>
  
  <p>The data matrix <code>end</code> is below:</p>
  
  <pre><code>      eyr em   
   [1,] 2014  7 25
   [2,] 2013  5 25
   [3,] 2008  7 25
   [4,] 2007  2 25
   [5,] 2006  5 25
   [6,] 2004  2 25
   [7,] 2002 12 25
   [8,] 2000 12 25
   [9,] 1999 12 25
  [10,] 1999 12 25
  </code></pre>