[R] Delete Dates from a vector.

pluribus pluribus at overdetermined.net
Sun Jan 25 05:01:43 CET 2009


I need to create a vector of dates, weekdays only for a function I am
working on. Thanks to the chron library, I have managed to accomplish
this, but is there is a better / easier way. This is what I have thus
far.

        range.dates <- seq.dates('02/02/2009', '03/13/2009', by =
        'days')
        range.days <- weekdays(range.dates)
        weekends <- which(range.days == "Sat" OR range.days == "Sun")
        range.dates[weekends] <- NA
        range.dates <- sort(range.dates)

I am trying to get better with R and I appreciate any feedback or
suggestions you may have.




More information about the R-help mailing list