I'm appending two datasets where both have columns for Date (YYYY/MM/DD HH:MM:SS), but one is a character and the other is date. The first df lists Date as "2022-01-01 01:00:00" and the second (crimes) lists Date as 01/01/2022 12:00:00 AM.
For my purposes, I do not need the HHMMSS or timezone characteristics.
I've tried:
crimes$Date <- format(as.POSIXct(crimes$Date,format='%I:%M %p'),format="%H:%M:%S")
crimes$Date <- format(as.POSIXct(crimes$Date,format="%Y-%m-%d %I:%M:%S %p"))
crimes$Date <- as.numeric(as.character(crimes$Date))
crimes$Date <- strptime(crimes$Date, format = "%Y-%m-%d %H:%M:%OS", tz = "EST")
Each of these changes the observations under date as NA.
Other options I've tried (and their error messages):
crimes$Date <- parse_date_time("%Y/%m/%d %I:%M:%S %p")
#Error in .best_formats(train, orders, locale = locale, select_formats, :
#argument "orders" is missing, with no default
crimes$Date <- format(as.POSIXct(crimes$Date), format='%y-%m-%d')
#Error in as.POSIXlt.character(x, tz, ...) :
#character string is not in a standard unambiguous format
What am I missing?