These methods let mdate vectors behave like ordinary character vectors
for subsetting, replacement, concatenation, and repetition,
while ensuring the result remains a validated mdate object.
Arguments
- x
An
mdateobject.- drop
Included for consistency with the default
[method; has no effect sincemdateobjects are always vectors.- i, ...
Index or indices, as for the default methods; for
c(), one or more objects to concatenate (coerced tomdatefirst).- value
A replacement value, coerced to
mdateand validated before assignment.
Value
An mdate object, except for c(), which returns the (unclassed)
result when called on a single object.
Examples
d <- as_messydate(c("2012-01-01", "2012-02-01", "2012-03-01"))
d[2]
#> 'mdate' chr "2012-02-01"
d[2] <- "2012-02-02"
c(d, as_messydate("2012-04-01"))
#> 'mdate' chr [1:4] "2012-01-01" "2012-02-02" "2012-03-01" "2012-04-01"
rep(d, 2)
#> 'mdate' chr [1:6] "2012-01-01" "2012-02-02" "2012-03-01" "2012-01-01" ...