convert invalid date to a valid date like value using R
问题 I have a dataframe like as shown below d1 <- c('21/01/2052 9:02','12/30/2042 9:25','10134-5-28 0:0:0','10109-12-27 0:0:0','10176-6-7 0:0:0') d2 <- c('22/03/2052 9:22','31/10/2043 9:25','10134-6-02 0:0:0','10109-12-30 0:0:0','10176-6-9 0:0:0') df_test <- c(d1,d2) Input I tried something like below using lubridate package but doesn't seem to help mdy_hm(df_test$d1) This resulted in a warning message and resulted in NAs for invalid values It's fine if invalid dates can't be processed and returns