I have a large dataset (a few millions observations) that contains a datetime variable with an inconsistent format: "%Y-%m-%d %H:%M:%S" ; "%m/%d/%Y and %H:%M:%S".
Here is how the dataset looks like:
df <- data.frame(var1 = c(1:6),
var2 = c("A", "B", "C", "A", "B", "C"),
datetime = c("2013-07-01 00:00:02", "2016-07-01 00:00:01",
"9/2/2014 00:01:20", "9/1/2014 00:00:25",
"1/1/2015 0:07", "6/1/2015 0:01"))
Is there an efficient way to format the datetime variable into a unique, consistent date time format?