I need to convert the "ride_length" column from character vector to numeric while preferably keeping same format HHH:MM:SS. If the only way to accomplish this is to convert to only seconds or minutes, that is an acceptable alternative. Ultimately I need to be able to analyze this data in a meaningful way, which I cannot do while it is in character vector. I have tried strptime(), chron(), POSIXct(), as.numeric() all with no success. "ride_length" was created in EXCEL before being imported.
I found a workaround by creating a new "ride_length" column and then converting to numeric using:
q1_2021$ride_length <- difftime(q1_2021$ended_at, q1_2021$started_at)
q1_2021$ride_length <- as.numeric(as.character(q1_2021$ride_length))
But (if possible) I want to understand how to answer the original question using the EXCEL created "ride_length" column.
Updating with dput(head()) which I'm hoping provides reproducible data. I removed the unnecessary columns:
structure(list(started_at = c("2/6/2021 15:56", "2/5/2021 14:22", "2/6/2021 20:21", "2/27/2021 21:07", "2/20/2021 23:23", "2/28/2021 17:50" ), ended_at = c("2/27/2021 14:06", "2/26/2021 9:42", "2/13/2021 11:28", "3/5/2021 15:11", "2/25/2021 16:12", "3/5/2021 2:14"), ride_length = c("502:09:14", "499:20:38", "159:07:08", "138:04:00", "112:49:54", "104:24:14" )), row.names = c(NA, -6L), class = c("tbl_df", "tbl", "data.frame" ))