This is not only not relevant to the question but also inaccurate, questions here don't get closed by anybody because of being unclear, they get closed automatically if there is no activity on a long period of time or if the content violates the forum policies.
In the future, if you want to attract attention to your question, work in providing a proper reproducible example.
Having said that, I think this does what you want.
library(dplyr)
library(lubridate)
sample_df <- tibble::tribble(
~person, ~start.time.h, ~start.time.m, ~end.time.h, ~end.time.m,
1, 8, 0, 10, 15,
1, 11, 15, 16, 35,
2, 8, 10, 13, 15,
2, 18, 0, 23, 15
)
sample_df %>%
mutate(start_time = hms::hms(hours = start.time.h, minutes = start.time.m),
end_time = hms::hms(hours = end.time.h, minutes = end.time.m)) %>%
group_by(person) %>%
mutate(ACTDUR = end_time %--% lead(start_time)/60) %>%
select(-start_time, -end_time)
#> # A tibble: 4 x 6
#> # Groups: person [2]
#> person start.time.h start.time.m end.time.h end.time.m ACTDUR
#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 8 0 10 15 60
#> 2 1 11 15 16 35 NA
#> 3 2 8 10 13 15 285
#> 4 2 18 0 23 15 NA
Created on 2020-03-07 by the reprex package (v0.3.0.9001)