title: calculate age from column birthdate and specified time in r
body: <p>Calculate age from given column <code>birth_date</code> and specified date <code>"2017-01-01"</code> with format <code>"%y-%m-%d"</code> in R.</p>
  
  <pre><code>name birth_date
   a    1964-09-01
   b    1977-01-02
   c    1977-01-04
   d    1967-01-02
   e    1977-04-02
   f    1945-01-02
  
   x &lt;- data.frame("name" =c("a","b","c","d","e","f"), "birth_date" = c("1964-09-01","1977-01-02","1977-01-04","1967-01-02","1977-04-02","1945-01-02"))
  x
  
  difftime(as.Date(x$birth_date),as.Date(2017-01-01), units = "years")
  </code></pre>