Skip to content
Prev 78902 / 398502 Next

adding 1 month to a date

Try this. Note that mapply strips off the class which is why we
set up dd with the correct class and then just replaced the values.

# test data
d <- as.Date("2005-1-1") + seq(0,90,30)

# calculations, dd is the result
next.month <- function(x) seq(x, len = 2, by = "months")[2]
dd <- d
dd[] <- mapply(next.month, dd)
On 10/12/05, t c <quantpm at yahoo.com> wrote: