dont_occur | R Documentation |
Create a schedule of events occurring only when the specified events do not occur.
dont_occur(x, y = NULL)
x, y |
Schedule objects. |
doesnt_occur()
can accept either one or two schedules as input(s):
When a single schedule is used, the function returns a schedule of all events that do not fall on on the input schedule. The result is the negation of the schedule. For example, the negation of all weekdays would be a schedule of all weekend days.
When two schedules are used, the function returns the first schedule but with the events of the second schedule stripped away. This works to remove the events of the second schedule from the first.
This means that doesnt_occur(a, b)
is the equivalent of
only_occur(a, doesnt_occur(b))
This usage works best when composing with the pipe (%>%
) operator.
A schedule object.
library(magrittr)
my_dates <- seq.Date(as.Date("1999-01-01"),
as.Date("1999-01-10"),
by = "1 day")
happen(in_month("Jan"), my_dates)
happen(dont_occur(in_month("Jan")), my_dates)
happen(on_wday("Sat"), my_dates)
happen(dont_occur(on_wday("Sat")), my_dates)
on_christmas <- only_occur(on_mday(25), in_month("Dec"))
on_new_years_day <- on_yday(1)
on_public_holidays <- also_occur(on_new_years_day, on_christmas)
on_business_days <-
dont_occur(on_weekend()) %>%
dont_occur(on_public_holidays)
happen(on_business_days, my_dates)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.