seq.clock_time_point | R Documentation |
This is a time point method for the seq()
generic. It works for sys-time
and naive-time 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 class '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 |
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
)
# Minutely sequence using minute precision naive-time
x <- as_naive_time(year_month_day(2019, 1, 2, 3, 3))
x
seq(x, by = 4, length.out = 10)
# You can use larger step sizes by using a duration-based `by`
seq(x, by = duration_days(1), length.out = 5)
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.