I have a database that needs to calculate the age of the members in it, below a sample extracted with dput
.
base.teste <- c("04/03/73", "10/09/67", "21/12/74", "17/04/76", "25/03/66",
"11/03/73", "06/08/79")
I need to calculate the age of all members by the end of November, 11/30/2017. I transofmrei the data in dates, lubridate
% and executed the following code:
library(lubridate)
idade <- floor(as.numeric(difftime(data.fim.mes, base.teste, units = "days"))/365.25)
But in the result I end up getting negative ages:
44 -50 42 41 -49 44 38
Does anyone know why or have a better way of calculating?