[R] Generating Sequence of Dates
Rainer Schuermann
rainer.schuermann at gmx.net
Mon Nov 21 08:30:45 CET 2011
> n = 2
> sort( rep( seq(as.Date("2000/1/1"), by="month", length.out=3), n ) )
[1] "2000-01-01" "2000-01-01" "2000-02-01" "2000-02-01" "2000-03-01"
[6] "2000-03-01"
On Sunday 20 November 2011 22:16:36 arunkumar1111 wrote:
> Hi.
>
> I need to generate a sequence of date, I need to generate date for a
> period. Each date should be generated n times.
>
> E.g
>
> seq(as.Date("2000/1/1"), by="month", length.out=3)
>
> the output of this is "2000-01-01" "2000-02-01" "2000-03-01"
>
> But i need each date to be generated n times, if n =2 my output
>
> "2000-01-01" "2001-01-01" "2000-02-01" "2000-02-01" "2000-03-01"
> "2000-03-01"
>
>
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Generating-Sequence-of-Dates-tp4090672p409
> 0672.html Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.
More information about the R-help
mailing list