#' hms_fix
#'
#' An easy function for calculating the total seconds of a time object
#' @param time_frame Your time object - could be a vector or a column (or columns) from a data frame
#' @export
hms_fix <- function(time_frame) {
time_frame <- as.character(time_frame)
time_frame <- str_split(time_frame,fixed(":")) #split the time into elements
time_frame <- time_frame[[1]] #convert from list to vector
hours <- as.numeric(time_frame[[1]])
minutes <- as.numeric(time_frame[[2]])
seconds <- as.numeric(time_frame[[3]])
z <- (hours * 3600) + (minutes * 60) + seconds
return(z)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.