Description Usage Arguments Details Value Examples
Return the indices of dates in a table that match, according to rules "before", "after", etc.
dateMatch()
is a generic, with
methods for character
, Date
, POSIXct
, and POSIXlt
.
1 2 3 |
x |
A |
table |
A |
how |
A character string.
Determines how values in
For convenience, |
error.how |
A character string.
Determines how to handle values in
See the note on argument |
nomatch |
The value to return for |
offset |
If an integer, this offset is added to the computed indices after
matching. (Can be an integer value represented as a float.) Non-integer
and non-numeric values cause an error. It is possible that later on,
character values may be allowed to specify a computed offset to the
values in |
value |
If |
optimize.dups |
If |
Uses match
and findInterval
to perform matching.
The indices of the matches for the elements of x
in table
,
or the actual matching values from table
if
value==TRUE
.
In the latter case, the class of the returned value is the same as the class of x
for character
, Date
, POSIXct
, and
POSIXlt
. For x
of other classes, the class of the
returned value is Date
, but this may change in the future.
1 2 3 4 5 6 7 8 9 10 | d1 <- dateParse(c("2001/01/10", "2001/03/12"))
d2 <- dateSeq(dateParse("2001/01/01"), by = "weeks", len = 20)
dateMatch(d1, dateParse(), how = "nearest", error.how = "drop")
dateMatch(d1, dateParse(), how = "nearest", error.how = "stop")
dateMatch(d1, dateParse(), how = "nearest.stop")
dateMatch(d1, d2, how = "after")
dateMatch(d1, d2, how = "after", offset = -3)
dateMatch(dateParse(c("2001/01/10", "2001/01/17", "2001/03/12")),
dateSeq(dateParse("2001/01/01"), by = "weeks", len = 20), how = "after",
offset = 10, value = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.