I am struggling to change the date column in my dataset into an actual date whilst also formatting it in mdy. I can get it into the correct format but it always reverts back to a string.
This is the code I have written for it:
walmart_data <- walmart_data %>%
mutate(Date = as.Date(Date, format = “%d-%m-%Y”))
walmart_data$Date <- format(as.Date(walmart_data$Date, format=”%Y-%m-%d”),”%m-%d-%Y”)
I am never able to get my dates as a date type while also simultaneously having them in the mdy format. Any help would be greatly appreciated.
Joe Beadles is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.