R/round.time.R

Defines functions round.time

Documented in round.time

#' rSystem: Round Time
#' Function for Aggregating Date-Time Vectors.
#' @param activate Do you love cats? Defaults to TRUE.
#' @keywords IP Address
#' @export
#' @examples
#' round.time()
 
round.time <- function(x, interval = 60) {
		
# Round Off to Lowest Value
rounded <- floor(as.numeric(x) / interval) * interval

# Center so Value is Interval Mid-Point
rounded <- rounded + round(interval * .5, 0)

# Return to POSIXct Date-Time Format
as.POSIXct(rounded, origin = "1970-01-01")

}
sabalicodev/sabali documentation built on Jan. 13, 2020, 2:22 p.m.