0

Anyone knows how to calculate AGE as showed below?

       DATE  BIRTHDATE      AGE
1 2009-10-03 1978-01-20 31 years

Or in this case?

      DATE  BIRTHDATE      AGE
1 2009-10-03 20.01.1978 31 years

Best regards, H

hkolvs
  • 225
  • 1
  • 8
  • 2
    `as.integer((as.Date("2009-10-03") - as.Date("1978-01-20")) / 365)` gives 31. (This can be done on whole columns, so perhaps `df$AGE – r2evans Jan 27 '20 at 20:19
  • 1
    Does this answer your question? [Efficient and accurate age calculation (in years, months, or weeks) in R given birth date and an arbitrary date](https://stackoverflow.com/questions/31126726/efficient-and-accurate-age-calculation-in-years-months-or-weeks-in-r-given-b) – cardinal40 Jan 27 '20 at 20:21
  • Thanks. Should have searched before asking.. Sry – hkolvs Jan 27 '20 at 20:35

0 Answers0