Some basic vector methods (subsetting, c, and data.frame-related) for messy dates are missing. This is a problem for common use cases:
Current behavior:
x <- as_messydate(c("2012-01-01", "2012-01-02"))
# Subsetting drops the class
class(x[1])
# [1] "character"
# Combining with another messy date drops the class
y <- c(x, as_messydate("2000-02-28"))
class(y)
# [1] "character"
# Can insert invalid dates, and they remain as-is
x[2] <- "not a date"
x
# 'mdate' chr [1:2] "2012-01-01" "not a date"
# Can't create a new data.frame with a messy date column
data.frame(a = x)
# Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors = stringsAsFactors) :
# cannot coerce class ‘"mdate"’ to a data.frame
I've written the methods and can make a pull request if you'd like.
Some basic vector methods (subsetting,
c
, and data.frame-related) for messy dates are missing. This is a problem for common use cases:Current behavior:
I've written the methods and can make a pull request if you'd like.