span_time | R Documentation |
seq.POSIXct
.Quickly create a sequence of datetimes from minimal specifications.
span_time(from, to = NULL, len_out = NULL, by = NULL, tz = "UTC")
from |
Integer or character of length 4 (yyyy), 6 (yyyymm), or 8 ( yyymmdd). Character of length 11 (yyyymmdd hh), 13 (yyyymmdd hhmm), or 15 ( yyyymmdd hhmmss). Indicating the start value of the sequence. |
to |
Integer or character of length 4 (yyyy), 6 (yyyymm), or 8 ( yyymmdd). Character of length 11 (yyyymmdd hh), 13 (yyyymmdd hhmm), or 15 ( yyyymmdd hhmmss). Indicating the end value of the sequence. Optional. |
len_out |
The desired length of the sequence. Optional. |
by |
The desired interval. Optional. |
tz |
The desired timezone. |
Minimal specification of datetimes, sets unspecified date parts to default values. These are 01 for both month and day and 00 for hour, minute, and second.
In addition to from
, either to
or length
must be specified.
If the by
is not specified, span_time
will set the interval to
the highest of the specified datetime parts in either from
or
to
. For example, if they are "20160103 01" and "20160108 05" it will
be "hour", if they are "2011" and "20110101 021823" it will be "second".
An object of class POSIXct.
# using to span_time(2011, 2013) span_time("2011", "2013") span_time(2011, 201301) span_time(2011, 20130101) span_time(2011, "20110101 0023") span_time(2011, "20110101 002300") # using len_out span_time(2011, len_out = 3) span_time("2011", len_out = 3) span_time(2011, len_out = 10, by = "month") span_time(2011, len_out = 10, by = "day") span_time(2011, len_out = 10, by = "hour") span_time("20110101 00", len_out = 10) span_time("20110101 002300", len_out = 10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.