Here is a representation of my dataset

```
ID<-1:5
Date1<-c(NA,NA,"2022-06-10",NA,NA)
Date2<-c(NA,NA,NA,NA,NA)
Date3<-c("2022-02-08",NA,NA,NA,NA)
Date4<-c(NA,NA,"2022-06-24",NA,"2022-05-13")

mydata<-data.frame(ID,Date1,Date2,Date3,Date4)

```

I want to create an additionnal date column in which I will have the last date available for each individual.

Like below

```
ID      Date1 Date2      Date3      Date4  last_date
1  1       <NA>    NA 2022-02-08       <NA> 2022-02-08
2  2       <NA>    NA       <NA>       <NA>       <NA>
3  3 2022-06-10    NA       <NA> 2022-06-24 2022-06-24
4  4       <NA>    NA       <NA>       <NA>       <NA>
5  5       <NA>    NA       <NA> 2022-05-13 2022-05-13

```