Last active
September 14, 2018 21:50
-
-
Save clarle/27e58f67784645be4746ba82456771ef to your computer and use it in GitHub Desktop.
Summing hours in HH:MM:SS format in R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
library(tidyr) | |
library(lubridate) | |
# Parse data from HH:MM:SS format into something that can be used by `lubridate` | |
hours %>% | |
separate(Duration, into = c("hours", "minutes", "seconds"), sep = ":", convert = TRUE) %>% | |
summarize(total_time = duration(hour = sum(hours), minute = sum(minutes), second = sum(seconds))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment