Re: [R] month increment for chron dates

2005-09-19 Thread bmw8042
Gabor, This is great. Thank you. It runs in just 3 seconds. Brian __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] month increment for chron dates

2005-09-18 Thread Gabor Grothendieck
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

[R] month increment for chron dates

2005-09-18 Thread bmw8042
I have a vector of over 7,000 chron dates in the format "mm/dd/yy". I need to increment each date in the vector by a standard number of months. Lapply with seq.dates is working OK; this increments the vector x by 3 months: dates(unlist(lapply(x, function(g) seq.dates(g, by="months", length=4)[4])