Returns the business days between from and to that are not in dates. Useful to check if a time series has gaps.

missing_bizdays(
  dates,
  cal = bizdays.options$get("default.calendar"),
  from = NULL,
  to = NULL
)

Arguments

dates

a vector of dates

cal

the calendar's name

from

the initial date, defaults to the first date in dates

to

the final date, defaults to the last date in dates

Value

A vector of Date objects with the missing business days. It is empty if no business day is missing or if dates has no valid dates.

To find the opposite, dates in dates that are not business days, use dates[!is.bizday(dates, cal)].

Examples

dates <- bizseq("2013-01-02", "2013-01-31", "Brazil/ANBIMA")[-c(3, 10)]
missing_bizdays(dates, "Brazil/ANBIMA")
#> [1] "2013-01-04" "2013-01-15"
# also check after the last date
missing_bizdays(dates, "Brazil/ANBIMA", to = "2013-02-08")
#> [1] "2013-01-04" "2013-01-15" "2013-02-01" "2013-02-04" "2013-02-05"
#> [6] "2013-02-06" "2013-02-07" "2013-02-08"