Creates a schedule of events occurring in the months specified.

in_month(...)

Arguments

...

A character or numeric vector of month elements.

Value

A schedule object.

Details

Months can be specified using their names (eg. "January"), abbreviations (eg. "Jan") or integers (eg. 1).

Multiple months can be specified in the same function call. For example: in_month(1, 3) produces a schedule of events occurring in January and March. The same thing is achieved by in_month("Jan", "Mar"). Similarly in_month(1:3) produces a schedule of events occurring in January, February and March.

Examples

my_dates <- seq.Date(as.Date("2000-01-01"), as.Date("2000-04-01"), by = "1 month") happen(in_month("January"), my_dates)
#> [1] TRUE FALSE FALSE FALSE
happen(in_month("Feb"), my_dates)
#> [1] FALSE TRUE FALSE FALSE
happen(in_month(3), my_dates)
#> [1] FALSE FALSE TRUE FALSE
happen(in_month("Jan", "Mar"), my_dates)
#> [1] TRUE FALSE TRUE FALSE
happen(in_month(1:3), my_dates)
#> [1] TRUE TRUE TRUE FALSE
## invalid inputs will produce an immediate error
# NOT RUN { in_january <- in_month("Janu") in_january <- in_month(0) # }