Skip to content
Prev 77412 / 398502 Next

month increment for chron dates

I don't know if this is any faster but it does not use any loops or apply
so maybe it is.  x is assumed to be a vector chron dates.  Note that
the question is not well specified for days near the end of the month
and I have not addressed that.

with(month.day.year(x), {
	year <- ifelse(month > 9, year + 1, year)
	month <- ifelse(month > 9, month - 9, month + 3)
	chron(paste(month, day, year, sep = "/"))
} )
On 9/18/05, bmw8042 <bmw8042 at verizon.net> wrote: