Calculate age from given column birth_date
and specified date "2017-01-01"
with format "%y-%m-%d"
in R.
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 <- 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")