seqmondate-methods | R Documentation |
Methods to generate date sequences.
This is essentially a wrapper for seq.mondate
that requires
from
and to
to be of the same class –
when both are specified –
and returns a sequence of that class.
The primary purpose is to generate sequences
in units of "months"
(the default value of the unnamed argument by
).
from |
|
to |
objects of class
|
... |
optional arguments passed to |
A sequence of the same class as from\to
.
signature(from = "mondate", to = "mondate", ...)
signature(from = "Date", to = "Date", ...)
signature(from = "POSIXlt", to = "POSIXlt", ...)
signature(from = "POSIXct", to = "POSIXct", ...)
signature(from = "ANY", to = "ANY", ...)
# 13 month-end dates starting with the end of 2014 and # ending with the end of 2015 seqmondate(mondate.ymd(2014), mondate.ymd(2015)) # In most situations, seq.Date and seqmondate return identical sequences, # as when 'from' is at the beginning of the month. s1 <- seq(as.Date("2015-01-01"), as.Date("2015-12-01"), by = "month") s2 <- seqmondate(as.Date("2015-01-01"), as.Date("2015-12-01")) stopifnot(identical(s1, s2)) # But when 'from' is near the end of a long month, seq.Date, seq.POSIXct, etc # can step into subsequent months (as documented in ?seq.POSIXt). seq(as.POSIXct("2015-01-31"), by = "month", length.out = 12) # ... contrasted with ... seqmondate(as.POSIXct("2015-01-31"), by = "month", length.out = 12)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.