How can I make vapply
return a date vector? (I think that's a different problem: Returning a vector of class POSIXct with vapply ):
f1 <- function(x) {
as.Date(paste0("2000", sprintf("%02d", x), "01"), format = "%Y%m%d")
}
vapply(3:7, f1, as.Date("2000-01-01"))
# [1] 11017 11048 11078 11109 11139
Want:
# "2000-03-01" "2000-04-01" "2000-05-01" "2000-06-01" "2000-07-01"