You may try parse_date_time
in package lubridate
which “allows the user to specify several format-orders to handle heterogeneous date-time character representations” using the orders
argument. Something like…
library(lubridate)
parse_date_time(x = df$date,
orders = c("d m y", "d B Y", "m/d/y"),
locale = "eng")
…should be able to handle most of your formats. Please note that b
/B
formats are locale
sensitive.
Other date-time formats which can be used in orders
are listed in the Details section in ?strptime
.