For some reason, split.Date forces the input of Date into an integer:
> split.Date function (x, f, drop = FALSE, ...) { y <- split.default(as.integer(x), f, drop = drop) for (i in seq_along(y)) class(y[[i]]) <- "Date" y } <bytecode: 0x2effb98> <environment: namespace:base>
This is at least the ambiguity between the function and the documentation, because ?Date says: "the date must be an integer, but this does not apply in the internal representation." Some may consider this a mistake. I'm not sure.
You can avoid this by calling split.default directly.
> split.default(as.Date(-1.0001, origin = "1970-01-01"), 1)[[1]] [1] "1969-12-30"
source share