I try to return the difference into the months, the problem its that the second columns do not have all the dates. when i try to run the code, the output is error. Appreciate any help?
Error in mutate():
! Problem while computing
diff.dt = case_when(...). Caused by error in seq.Date()`:
! 'from' must be of length 1
I couldn't get ymd() to work with your code sample since your dates are in dmy() format (I get a [All formats failed to parse] error), but you can use an ifelse() statement to get a difference in seconds once that is resolved using as.POSIXct().
As mentioned by FJCC, you need to define the month time (30 days for example), and convert all the seconds to days. 14 days in this example would be ~0.47 months (14/30).