On Wed, Mar 9, 2011 at 4:13 PM, Dimitri Liakhovitski
<dimitri.liakhovit...@gmail.com> wrote:
> I realize I can do something like this:
> date<-20081229
> mydates<-as.Date(as.character(date),"%Y%m%d")
> for(i in 1:52){  #
>  mydates<-c(mydates,mydates[length(mydates)]+7)
> }
>
> I just thought maybe there is a more elegant way...
> Thank you!

Here are two approaches:

as.Date("2008-12-29") + seq(0, length = 53, by = 7)

seq(as.Date("2008-12-29"), length = 53, by = "week")

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to