I have a dataframe with a Date column. The date for some reason is character type and either of the excel number type like “40515” or of the type “01/01/1995”. How can I change all of the them to R format given both formats use different commands to change them.
Thanks!
I made a new function which would check if there is “/” in the variable and based on that treat them differently, however, that didn’t work and my excel dates were just NA
convert_date <- function(date) {
ifelse(grepl("/", date), lubridate::dmy(date), as.Date(as.numeric(date), origin = "1899-12-30"))
}