I am doing a case study on bike share. Trying to calculate the time spent (in minutes) by each user , which would occur by subtracting the end time by start time.
I first tried to create new start_time and end_time columns .After which I can do calculations, using the following commands:
df_cyclistic_copy$started_at_time <- as.POSIXct(df_cyclistic_copy$started_at_datetime, format = "%d-%m-%Y %H:%M")
df_cyclistic_copy$ended_at_time <- as.POSIXct(df_cyclistic_copy$ended_at, format = "%d-%m-%Y %H:%M")
A column is created but with NA
I even checked the class of the new started_at_time column. It is POSIXct
I do not understand. Where am I wrong? (Note: I am new to programming in general)