On Wed, Nov 19, 2008 at 12:54 PM, Brigid Mooney <[EMAIL PROTECTED]> wrote: > Hi All, > > I am iterating through dated materials, with variable start and end dates, > and would like to skip procedures everytime I encounter a weekend or > holiday. To do this, I thought the easiest way would be to create a > TRUE/FALSE vector corresponding to each day where it is TRUE if a workday, > and FALSE if a weekend or holiday. > > So far I have been able to do this for weekdays: > > startDate <- as.Date("2008-08-15") > endDate <- as.Date("2008-09-15") > > AllDays <- seq(startDate, endDate, by="day") > > WorkDays <- ifelse(as.numeric(format(startDate+days-1, "%w"))%%6==0, FALSE, > TRUE) > > But I'm a bit lost as to what to do for the holidays, for example > "2008-09-01" is Labor Day in the above range. > > Is there some procedure to say if an object is "in" a given list or set?
Have a look at ?"%in%" Hadley -- http://had.co.nz/ ______________________________________________ R-help@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.