X-Git-Url: http://git.vanrenterghem.biz/R/operatingdays.git/blobdiff_plain/e764b1aec411639c89468930fbc83d6185ba61f3..fd69ff33c0816f78abc50b740aa5250de7899b7c:/R/getRemainingOpDays.R diff --git a/R/getRemainingOpDays.R b/R/getRemainingOpDays.R index 9325670..a201071 100644 --- a/R/getRemainingOpDays.R +++ b/R/getRemainingOpDays.R @@ -1,8 +1,13 @@ -# getRemainingOpDays +#' getRemainingOpDays # This is a function that returns the remaining operating days in a month # It takes as arguments the country, state, date for which the request is made. # It returns a number # It currently only supports AU (Australia) +#' @param country A country - use ISO format (currently only takes AU) +#' @param state A state - use 2 or 3 letter abbreviation, in capitals +#' @param date A date from which the remaining operating days in the month will be counted +#' @return The number of remaining operating days in \code{state}, \code{country} as of \code{date} +#' @examples getRemainingOpDays("AU","WA","2016-05-10") getRemainingOpDays <- function(country,state,date) { cutoff.time = "15:00" @@ -16,6 +21,7 @@ getRemainingOpDays <- function(country,state,date) { state.public.holidays <- public.holidays[public.holidays$Applicable.To %in% c(state,"NAT"),] state.public.holidays$Date<-as.Date(state.public.holidays$Date,"%Y%m%d") + date <- as.Date(date) today <- Sys.Date() startdate <- as.Date(cut(date, "month")) enddate <- seq(startdate, by = "1 months", length.out = 2)[2]