[R] seq.dates in reverse?

Jonathan Greenberg greenberg at ucdavis.edu
Wed Jun 30 02:17:09 CEST 2010


Pardon the barrage of time series related questions, but another issue
I'm trying to solve is how to determine a sequence of dates a la
seq.dates() except going BACKWARDS in time, e.g. if seq.dates()
allowed for the "to" variables to be set alone, rather than the from=.
 Ultimately, I'd like to have a set of dates preceding a given date in
predefined intervals (the same ones seq.dates() uses would be fine).
Thoughts?  Would there be an easy way to "reverse engineer" a starting
date given the "by=" variable and the "length="?  With the exception
of using "by=days", I'm a bit unfamiliar with how to easily determine
what date was, say, 4 months ago without doing a lot of string hacking
(seq.dates() conveniently keeps the days of the month constant when
generate date sequences, which is what I'd like).

--j



More information about the R-help mailing list