[R] month increment for chron dates

bmw8042 bmw8042 at verizon.net
Sun Sep 18 15:44:15 CEST 2005


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])))

But this takes about 55 seconds to run on a Windows XP 1.8 Pentium 512 RAM
PC with R version 2.0.0
Can you recommend a more efficient way to do this?

thanks for your advice

Brian Winkler
Controller
BPS Trade Services
CGI




More information about the R-help mailing list