I have a longitudinal data set and I'm struggling to add the missing dates for the follow-up based on the baseline date of visit. Would be great to receive your help.
My code is:
test <- test %>%
filter(Visit == 1) %>% # 1st visit after baseline which is at 6 months
mutate(new_var = if_else(is.na(Follow_up_date), dmy(dateofrandomisation) %m+% month(6),0))
I'm getting the following error: Error in as.POSIXlt.numeric(x) : 'origin' must be supplied