trunc.times.RdTruncate times objects.
# S3 method for class 'times'
trunc(x, units = "days", eps = 1e-10, ...)The time is truncated to the second, minute, hour or day or to the value specified.
There is also a round method which has the same arguments as
the trunc method, and performs rounding instead of truncation.
An object of class "times".
trunc for the generic function and default methods.
tt <- times(c("12:13:14", "15:46:17"))
trunc(tt, "minutes")
#> [1] 12:13:00 15:46:00
trunc(tt, "min")
#> [1] 12:13:00 15:46:00
trunc(tt, times("00:01:00"))
#> [1] 12:13:00 15:46:00
trunc(tt, "00:01:00")
#> [1] 12:13:00 15:46:00
trunc(tt, 1/(24*60))
#> [1] 12:13:00 15:46:00
tt2 <- structure(c(3.0, 3.1, 3.5, 3.9), class = "times")
trunc(tt2, "day")
#> Time in days:
#> [1] 3 3 3 3
trunc(tt2)
#> Time in days:
#> [1] 3 3 3 3