I have a vector of dates and I want to set the date to NA if it is prior to another vector.
I tried ifelse(date_vector1>=date_vector2, date_vector1, NA), but the output is not a Date and applying as.Date() return an error.
I then tried dplyr::if_else(date_vector1>=date_vector2, date_vector1, NA_real_), but it returns the same error.
The error is this one :
Error in as.Date.numeric(value) : 'origin' must be supplied
How can I use the ifelse statement with dates ?