I have to combine several spreadsheets for my project and for some reason they all decided to enter the dates differently. Below is a sample of my data with all of the different date formats I got after reading in and combining all of the spreadsheets.
date
13-MAR-18
2018-08-05
43423
11-Mar-2019
10/16/2018
I'm trying to standardize everything and turn it into a yyyy-mm-dd format. This is my attempt below.
library(lubridate)
parse_date_time(x = df$date,
orders = c("Y m d, "d m y", "d B Y", "m/d/y", ),
locale = "eng")
The problem is that the moment I reach a row with a different format, it stops working and just gives me NA's for the rest of the rows. How do I fix this?
Expected output
date new_date
13-MAR-18 2018-03-13
2018-08-05 2018-08-05
43423 2018-11-19
11-Mar-2019 2019-03-11
10/16/2018 2018-10-16