[R] Generating sequence of dates

Vadlamani, Satish {FLNA} SATISH.VADLAMANI at fritolay.com
Wed Oct 28 12:57:42 CET 2009


Hello All:
I have the following question

# instantiate a date
current = as.Date("2009/10/25")

#generate a sequence of dates in the future
future_dates = seq(current,by='1 week',length=53)

Question: How to generate a sequence of past dates starting one week in the past relative to the current date. Obviously, what I wrote below is not correct. I think I can write a for loop and push each value into a vector. Is this the best way? Thanks.

Satish


past_dates = seq(current,by=-'1 week',length=156)




More information about the R-help mailing list