I have a messy dataframe with thousand variables and want to automate conversion of specific columns to dates without having to specify which columns explicitely. All columns to convert have "Date" in their name. Most are mdy
but they also can be dmy
. Some contain errors, or malformatted dates but in a very very minor proportion <0.1%.
I tried:
df %>% select(contains("Date")) %>% as_Date() #Does not work
df %>% select(contains("Date")) %>% mdy() #selecting only the columns with dates, does not work
df %>% select(contains("Date")) %>% parse_date_time( c("mdy", "dmy")) #also does not work
I think I dont get something fundamental.