Im new to R (and programming in general) so any help is much appreciated. In my dataframe (Data_Trip) , I've calculated the difference between two datetimes but want to convert the output from seconds to minutes. The new column is named time_rented.
For almost all things time-related the {lubridate} package is a sanity preserver. If your data had start/finish as variables, for example
library(lubridate)
#>
#> Attaching package: 'lubridate'
#> The following objects are masked from 'package:base':
#>
#> date, intersect, setdiff, union
# recorded as character class in data
begin <- "2022-10-22 14:43:04"
finish <- "2022-10-22 14:03:44"
# convert to datetime class
begin <- ymd_hms(begin)
finish <- ymd_hms(finish)
(elapsed <- finish - begin)
#> Time difference of -39.33333 mins
But, let's work with what you've got, which is a variable, time_rented of character strings.