Description Usage Arguments Examples
before_mday_in_month()
: Is the date before the day of the month mday
in month month
?
after_mday_in_month()
: Is the date after the day of the month mday
in month month
?
between_mdays_in_months()
: Is the date between the day of the month
x_mday
in month x_month
and y_mday
in month y_month
?
These functions are convenient helpers for defining events such as "before January 24th". They are constructed from lower level event creators, but are common enough to stand alone.
1 2 3 4 5 | after_mday_in_month(month, mday, inclusive = FALSE)
before_mday_in_month(month, mday, inclusive = FALSE)
between_mdays_in_months(x_month, x_mday, y_month, y_mday)
|
month, x_month, y_month |
A month of the year. Combined with |
mday, x_mday, y_mday |
A day of the month. |
inclusive |
Should the date defined by |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | # Any day before Feb 25th
before_feb_25 <- before_mday_in_month("Feb", 25)
event_in("2019-01-01", before_feb_25)
event_in("2019-01-26", before_feb_25)
# You might think that you could construct this helper
# from these two lower level event helpers
bad_before_feb_25 <- before_mday(25) & before_month("Feb")
# But the logic isn't right! It works when both conditions are true,
# but Jan-26 is before Feb-25, but registers as a non-event with this logic
# because 26 > 25.
event_in("2019-01-01", bad_before_feb_25)
event_in("2019-01-26", bad_before_feb_25)
# The actual condition is more like:
strictly_before_feb <- before_month("Feb", inclusive = FALSE)
in_feb_and_before_25th <- on_month("Feb") & before_mday(25)
good_before_feb_25 <- strictly_before_feb | in_feb_and_before_25th
event_in("2019-01-01", good_before_feb_25)
event_in("2019-01-26", good_before_feb_25)
# This pattern can be used to construct other similar helpers that
# we have chosen not to export, but still might be useful. For example:
# "After the 15th day in the 2nd quarter"
strictly_after_q2 <- after_quarter(2, inclusive = FALSE)
in_q2_and_after_15th_qday <- on_quarter(2) & after_qday(15)
after_15th_day_in_q2 <- strictly_after_q2 | in_q2_and_after_15th_qday
event_in(as.Date("2019-04-01") + days(14), after_15th_day_in_q2)
event_in(as.Date("2019-04-01") + days(15), after_15th_day_in_q2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.