[R] Generating sequences of dates

Rui Barradas ruipbarradas at sapo.pt
Fri Nov 30 14:03:24 CET 2012


Hello,

Try the following.


Y <- 2000:2001
M <- 1:12
D <- 1
x <- expand.grid(Y, M, D)

Dates <- sort(as.Date(apply(x, 1, paste, collapse = "-")))


Hope this helps,

Rui Barradas
Em 30-11-2012 12:26, Vasilchenko Aleksander escreveu:
> Hello,
>
> I have the starting date in UNIX_TIME LONG number (number of milliseconds
> since 1970 jan 1st).
>
> Is there a way to generete the sequence of dates with monthly interval in
> POSIXct format like
>
> 2000-01-01
> 2000-02-01
> 2000-03-01
>
> etc
>
> Thanks
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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