I am having a problem to calculate the age of all my participants.
I have the date of birth recorded only in terms of month and year (XX/XXXX) and I have the exact date when the data was recorded (XX/XX/XXXX).
I wanted to use the age_calc function from the eeptools package to calculate the age. Unfortunately, something does not work. I suspect it is because one date is exact whereas the other is not specifying the exact date.
This is what I have tried:
df$birthdate <- as.Date(df$birthdate)
df$visitdate <- as.Date(df$visitdate)
age <- age_calc(df$birthdate,enddate=df$visitdate, unit="year")
The response I get is: "Both dob and enddate must be Date class objects".
So what I am thinking is to change the birthdate to always the first day of the month in order to get it to work. Unfortunately, I don't know how to do that. Can anyone help out? Is there a better way of handling this problem?
Thanks in advance! Lukas