My dataset "ride_history" has a variable name "total_time_spend". Here the values are in HH:MM:SS (example: 03:26:30) format and the variable type is "char". I want to convert it into a new variable "minute" and add it in the dataset. How to do it?
I have used "separate" function to make new colum Hour,minute,sec. But those column are not "numeric". That's why I use "as.numeric" to calculate a new variable "total_minute". After that, I used "cbind" to make new dataset!
Using
hmsandlubridatepackages you could do:EDIT A second option would be to use
tidyr::separateto split the time string into its components: