Try this:
weekdays(seq(fini,to = ffin, by='days'))
or in a loop:
sapply(as.character(seq(fini,to = ffin, by='days')),
function(d)weekdays(as.Date(d)))
On Fri, Dec 12, 2008 at 4:55 PM, Fernando Bizuet <[email protected]> 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]]
>
> ______________________________________________
> [email protected] 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.
>
--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.