timegrid {datetimeutils} | R Documentation |
POSIXct Time Grid
Description
Build an equally-spaced sequence of POSIXct timestamps.
Usage
timegrid(from, to, interval,
exclude.weekends = TRUE, holidays = NULL,
fromHHMMSS = "080000", toHHMMSS = "220000")
Arguments
from |
a vector of length one that inherits from class
|
to |
a vector of length one that inherits from class |
interval |
A character string like “ |
exclude.weekends |
logical; default is |
fromHHMMSS |
A character vector of length one like
“ |
toHHMMSS |
A character vector of length one like
“ |
holidays |
A vector of class |
Details
timegrid
creates an equally-spaced grid of class POSIXct
.
Value
a vector of class POSIXct
(or a character vector of
length zero, in case no valid points remain)
Author(s)
Enrico Schumann
References
B.D. Ripley and K. Hornik. Date-Time Classes. R-News, 1(2):8–12, 2001.
See Also
Examples
from <- as.POSIXct("2012-04-30 08:00:00")
to <- as.POSIXct("2012-05-04 22:00:00")
timegrid(from, to, interval = "1 hour",
holidays = as.Date("2012-05-01"))
timegrid(as.POSIXct("2017-06-23 21:00:00"), ## system timezone
as.POSIXct("2017-06-26 10:00:00"),
interval = "15 min")
timegrid(as.POSIXlt("2017-06-23 21:00:00", tz = "UTC"),
as.POSIXlt("2017-06-26 10:00:00", tz = "UTC"),
interval = "15 min")