Skip to contents

return rounded seconds from time

Usage

obs_roundtime(x, n = 10)

Arguments

x

time as "POSIXct" "POSIXt"

n

factor

Value

numeric vector

Examples

{
x <- Sys.time() + seq(1, 55, 1)
paste0(x,"  ",
       obs_roundtime(x), "  ",
       obs_freq(data.table::second(x),
                seq(0, 55, 10)))
}
#>  [1] "2024-11-14 00:28:30.369802  30  20" "2024-11-14 00:28:31.369802  30  30"
#>  [3] "2024-11-14 00:28:32.369802  30  30" "2024-11-14 00:28:33.369802  30  30"
#>  [5] "2024-11-14 00:28:34.369802  30  30" "2024-11-14 00:28:35.369802  30  30"
#>  [7] "2024-11-14 00:28:36.369802  30  30" "2024-11-14 00:28:37.369802  30  30"
#>  [9] "2024-11-14 00:28:38.369802  40  30" "2024-11-14 00:28:39.369802  40  30"
#> [11] "2024-11-14 00:28:40.369802  40  30" "2024-11-14 00:28:41.369802  40  40"
#> [13] "2024-11-14 00:28:42.369802  40  40" "2024-11-14 00:28:43.369802  40  40"
#> [15] "2024-11-14 00:28:44.369802  40  40" "2024-11-14 00:28:45.369802  40  40"
#> [17] "2024-11-14 00:28:46.369802  40  40" "2024-11-14 00:28:47.369802  40  40"
#> [19] "2024-11-14 00:28:48.369802  50  40" "2024-11-14 00:28:49.369802  50  40"
#> [21] "2024-11-14 00:28:50.369802  50  40" "2024-11-14 00:28:51.369802  50  50"
#> [23] "2024-11-14 00:28:52.369802  50  50" "2024-11-14 00:28:53.369802  50  50"
#> [25] "2024-11-14 00:28:54.369802  50  50" "2024-11-14 00:28:55.369802  50  50"
#> [27] "2024-11-14 00:28:56.369802  50  50" "2024-11-14 00:28:57.369802  50  50"
#> [29] "2024-11-14 00:28:58.369802  0  50"  "2024-11-14 00:28:59.369802  0  50" 
#> [31] "2024-11-14 00:29:00.369802  0  0"   "2024-11-14 00:29:01.369802  0  0"  
#> [33] "2024-11-14 00:29:02.369802  0  0"   "2024-11-14 00:29:03.369802  0  0"  
#> [35] "2024-11-14 00:29:04.369802  0  0"   "2024-11-14 00:29:05.369802  0  0"  
#> [37] "2024-11-14 00:29:06.369802  0  0"   "2024-11-14 00:29:07.369802  0  0"  
#> [39] "2024-11-14 00:29:08.369802  10  0"  "2024-11-14 00:29:09.369802  10  0" 
#> [41] "2024-11-14 00:29:10.369802  10  0"  "2024-11-14 00:29:11.369802  10  10"
#> [43] "2024-11-14 00:29:12.369802  10  10" "2024-11-14 00:29:13.369802  10  10"
#> [45] "2024-11-14 00:29:14.369802  10  10" "2024-11-14 00:29:15.369802  10  10"
#> [47] "2024-11-14 00:29:16.369802  10  10" "2024-11-14 00:29:17.369802  10  10"
#> [49] "2024-11-14 00:29:18.369802  20  10" "2024-11-14 00:29:19.369802  20  10"
#> [51] "2024-11-14 00:29:20.369802  20  10" "2024-11-14 00:29:21.369802  20  20"
#> [53] "2024-11-14 00:29:22.369802  20  20" "2024-11-14 00:29:23.369802  20  20"
#> [55] "2024-11-14 00:29:24.369802  20  20"