Your question indicates that you already have a list of working days, and you need a way to find the minimum and maximum for each combination of the year and month.
You can use ddply in the plyr package for this. I also use the lubridate package because it has some handy features for retrieving the year and month from a date.
Create some data:
library(lubridate) x <- sample(seq(as.Date("2011-01-01"), by="1 day", length.out=365), 100) df <- data.frame(date=x, year=year(x), month=month(x))
Now extract min and max for each month:
library(plyr) ddply(df, .(year, month), summarize, first=min(date), last=max(date)) year month first last 1 2011 1 2011-01-03 2011-01-30 2 2011 2 2011-02-03 2011-02-19 3 2011 3 2011-03-06 2011-03-29 4 2011 4 2011-04-09 2011-04-30 5 2011 5 2011-05-01 2011-05-29 6 2011 6 2011-06-04 2011-06-28 7 2011 7 2011-07-02 2011-07-29 8 2011 8 2011-08-10 2011-08-30 9 2011 9 2011-09-01 2011-09-28 10 2011 10 2011-10-07 2011-10-31 11 2011 11 2011-11-01 2011-11-28 12 2011 12 2011-12-01 2011-12-30
source share