loop with dates
Try iterating over the index rather than the value of each component: s <- seq(fini,to = ffin, by='days') for (i in seq_along(s)) print(s[[i]])
On Fri, Dec 12, 2008 at 1:55 PM, Fernando Bizuet <fbizuet at gmail.com> wrote:
Hello,
I am trying to do a loop with dates, but when I try to use the index is not
a date.
Fcorte <- as.Date('2008/11/30',format = "%Y/%m/%d")
fini <- Fcorte + 1
ffin <- seq(fini,by='months',length=2)[2] - 1
for (i in seq(fini,to = ffin, by='days'))
print (weekdays(i)) # i doesn't a date
How can I do a loop with dates and get the index of each date? are there a
method to convert the index i to date?
Thanks in advance.
[[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.