The column 'started_at' (third column) contains dates and time in the format DD/MM/YYYY HH:MM. I am trying to create a new column called date that uses the date information from the 'started_at' column. To do this, I use the following code chunk:
all_trips$date <- as.Date(all_trips$started_at)
When I run this in R, the column that is created doesn't extract the correct date from the 'started_at' column. for example, instead of returning '27/11/2021' it returns '0027-11-20'. This is shown in the image above where the new column 'date' is all the way at the bottom and the 'started_at' column is the third column from the top.
Hello.
Thanks for providing code , but you could take further steps to make it more convenient for other forum users to help you.
Share some representative data that will enable your code to run and show the problematic behaviour.
You might use tools such as the library datapasta, or the base function dput() to share a portion of data in code form, i.e. that can be copied from forum and pasted to R session.