timediff results in 0

Hi, im trying to get the use time of a service that has a stamp time but the result that i get with timediff() is 0
i have tried to use as.POSIXct, as.Date but the result is the same

The data that im working its a combination of the csv's of 12 months so its 19 x 3.6m rows

datapasta::df_paste(head(Cyclist_data, 5)[, c('started_at', 'ended_at','use_time')])
#> Error in head(Cyclist_data, 5): objeto 'Cyclist_data' no encontrado

data.frame(
  stringsAsFactors = FALSE,
                                     started_at = c("2020-04-26 17:45:14",
                                                    "2020-04-17 17:08:54",
                                                    "2020-04-01 17:54:13",
                                                    "2020-04-07 12:50:19","2020-04-18 10:22:59"),
                                       ended_at = c("2020-04-26 18:12:03",
                                                    "2020-04-17 17:17:03",
                                                    "2020-04-01 18:08:36",
                                                    "2020-04-07 13:02:31","2020-04-18 11:15:54"),
          use_time = c("0", "0", "0", "0", "0")
          )
#>            started_at            ended_at use_time
#> 1 2020-04-26 17:45:14 2020-04-26 18:12:03        0
#> 2 2020-04-17 17:08:54 2020-04-17 17:17:03        0
#> 3 2020-04-01 17:54:13 2020-04-01 18:08:36        0
#> 4 2020-04-07 12:50:19 2020-04-07 13:02:31        0
#> 5 2020-04-18 10:22:59 2020-04-18 11:15:54        0


Cyclist_help$use_time <- difftime( as.Date(Cyclist_data$ended_at)   ,
                                   as.Date(Cyclist_data$started_at) ,
                                   units = "mins")
#> Error in as.Date(Cyclist_data$ended_at): objeto 'Cyclist_data' no encontrado

Created on 2022-01-27 by the reprex package (v2.0.1)

3 posts were merged into an existing topic: Results is 0 in difftime

Please do not duplicate open topics