This is a time point method for the seq()
generic. It works for systime
and naivetime vectors.
Sequences can be generated for all valid time point precisions (daily through nanosecond).
When calling seq()
, exactly two of the following must be specified:
to
by
Either length.out
or along.with
# S3 method for clock_time_point seq(from, to = NULL, by = NULL, length.out = NULL, along.with = NULL, ...)
from 
A time point to start the sequence from.


to 
A time point to stop the sequence at.

by 
The unit to increment the sequence by. If If If If 
length.out 
The length of the resulting sequence. If specified, 
along.with 
A vector who's length determines the length of the resulting sequence. Equivalent to If specified, 
...  These dots are for future extensions and must be empty. 
A sequence with the type of from
.
# Daily sequence seq( as_naive_time(year_month_day(2019, 1, 1)), as_naive_time(year_month_day(2019, 2, 4)), by = 5 )#> <time_point<naive><day>[7]> #> [1] "20190101" "20190106" "20190111" "20190116" "20190121" #> [6] "20190126" "20190131"# Minutely sequence using minute precision naivetime x < as_naive_time(year_month_day(2019, 1, 2, 3, 3)) x#> <time_point<naive><minute>[1]> #> [1] "20190102 03:03"#> <time_point<naive><minute>[10]> #> [1] "20190102 03:03" "20190102 03:07" "20190102 03:11" "20190102 03:15" #> [5] "20190102 03:19" "20190102 03:23" "20190102 03:27" "20190102 03:31" #> [9] "20190102 03:35" "20190102 03:39"# You can use larger step sizes by using a durationbased `by` seq(x, by = duration_days(1), length.out = 5)#> <time_point<naive><minute>[5]> #> [1] "20190102 03:03" "20190103 03:03" "20190104 03:03" "20190105 03:03" #> [5] "20190106 03:03"# Nanosecond sequence from < as_naive_time(year_month_day(2019, 1, 1)) from < time_point_cast(from, "nanosecond") to < from + 100 seq(from, to, by = 10)#> <time_point<naive><nanosecond>[11]> #> [1] "20190101 00:00:00.000000000" "20190101 00:00:00.000000010" #> [3] "20190101 00:00:00.000000020" "20190101 00:00:00.000000030" #> [5] "20190101 00:00:00.000000040" "20190101 00:00:00.000000050" #> [7] "20190101 00:00:00.000000060" "20190101 00:00:00.000000070" #> [9] "20190101 00:00:00.000000080" "20190101 00:00:00.000000090" #> [11] "20190101 00:00:00.000000100"