seq.mondate | R Documentation |
Generate regular mondate
sequences.
## S3 method for class 'mondate' seq(from, to, by, ..., right = TRUE)
from |
coercible to a |
to |
coercible to a |
by |
increment of the sequence.
If numeric, a sequence is generated using the underlying numeric value(s)
of the coerced argument(s) and converted to a mondate object
(see |
... |
optional arguments passed to |
right |
in the case when |
For more details about sequence generation, see seq
.
If from
and to
are both provided,
the displayFormat
and timeunits
properties are
taken from from
,
without a warning if from
's properties differ from
to
's.
A mondate
vector with slots
(including displayFormat
, timeunits
, formatFUN
)
from argument from
, if provided, otherwise from argument to
.
Dan Murphy
seq
, seq.Date
and seqmondate
x <- mondate.ymd(2010, 1) # January 31, 2014 y <- mondate.ymd(2010, 12) # December 31, 2014 seq(from = x, to = y, by = 1) # all month-ends in 2014 # 8 quarter-ends beginning 1st quarter 2009; US displayFormat seq(mondate("3/31/2009"), by = 3, length.out = 8) # 8 quarter-ends ending year-end 2009; R's date format seq(to = mondate("2009-12-31"), by = 3, length.out = 8) # # Use of RIGHT = FALSE in seq.mondate is depracated. # Instead, to generate sequences of # Dates corresponding to the first days of the months # use the seq.Date method. seqmondate(as.Date("2014-01-01"), by = "months", length = 12) # To generate the last day of a sequence of months, # use the default right = TRUE: (m <- seq.mondate(as.Date("2014-01-31"), by = "months", length = 12)) # Coerce back to Date if necessary: as.Date(m) # Note how the Date method yields a different sequence, not corresponding to # the last day of the month. seq(as.Date("2014-01-31"), by = "months", length = 12)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.