Hello,
I'm having trouble subtracting two different columns of time. The output that I am receiving is wildly off. For example:
started_at = 2020-05-27 10:03:52
ended_at = 2020-05-27 10:16:49
I used this to convert the columns:
bike_data[["started_at"]] <-as.POSIXct(bike_data[["started_at"]],format = "%Y-%m-%d %H:%M:%S")
bike_data[["ended_at"]] <-as.POSIXct(bike_data[["ended_at"]],format = "%Y-%m-%d %H:%M:%S")
However, when I subtract, the value I get for the example given above is 13,623 seconds, when it should be around 780 seconds.
bike_data$duration <- bike_data$ended_at - bike_data$started_at
I've also tried to use the ymd_hms() function of lubridate to convert the columns but I run into the same issue.
What am I doing wrong?