How can I calculate the time difference between these two column in minute?
also, I have problem like second row that they are different day.
How can I calculate the time difference between these two column in minute?
also, I have problem like second row that they are different day.
You can use lubridate.
By the way, post code, not screenshots of your code or data. It makes it easier for people to answer your question.
library(tidyverse)
library(lubridate)
df <- tibble(started_at = c(ymd_hm("202007091522", "202007242356")),
ended_at = c(ymd_hm("202007091525", "202007250020"))
)
df %>%
mutate(minutes_between = interval(started_at, ended_at) / minutes(1))
# A tibble: 2 x 3
started_at ended_at minutes_between
<dttm> <dttm> <dbl>
1 2020-07-09 15:22:00 2020-07-09 15:25:00 3
2 2020-07-24 23:56:00 2020-07-25 00:20:00 24
I'm apologize for the screenshot first and I appreciate your help!
I'm going to do some research on your code the reply the result later.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.