R/ts2minutes.R

Defines functions ts2minutes

Documented in ts2minutes

#' Timestamp 2 minutes
#'
#' \code{ts2minutes} calculates the elapsed minutes of the day from 00:00.
#'
#' @param ts A vector of timestamps with class POSIXct.
#'
#' @return A integer vector with the elapsed minutes since 00:00.
#'
#' @examples
#'
#'
#' @import data.table

ts2minutes <- function(x) {
  ceiling(as.numeric(as.difftime(strftime(x, format = "%H:%M:%S", tz = "UTC"),
                                 format = "%H:%M:%S", units = "mins")))
  }
maxkroeschel/activitytools documentation built on Aug. 31, 2024, 8:50 p.m.