Try:

networkdays <- function(start, end, holidays)
{
dates <- seq(as.Date(start), as.Date(end), by="day")

if(missing(holidays))holidays <- 0 else holidays <- length(holidays)
sum(as.numeric(format(dates, "%w") > 1)) - holidays
}

networkdays("2008-04-01", "2008-04-30")

networkdays("2008-04-01", "2008-04-30", "2008-04-21")

On Thu, Apr 10, 2008 at 5:54 PM, tom soyer <tom.soyer@gmail.com> wrote:

> Hi,
>
> Does anyone know if R has a built-in function that is similar to Excel's
> NETWORKDAYS function? i.e., Returns the number of whole working days
> between
> two dates. Working days exclude weekends.
>
> Thanks,
>
> --
> Tom
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

	[[alternative HTML version deleted]]

