alma_next {almanac}R Documentation

Generate the next or previous event

Description

Usage

alma_next(x, rschedule, inclusive = FALSE)

alma_previous(x, rschedule, inclusive = FALSE)

Arguments

x

[Date]

A vector of dates.

rschedule

[rschedule]

An rschedule, such as an rrule or rbundle.

inclusive

[logical(1)]

If x is an event, should it be considered the next or previous event?

Value

A Date vector the same size as x.

Examples

on_12th <- monthly() %>% recur_on_mday(12)
on_monday <- weekly() %>% recur_on_wday("Monday")

# On the 12th of the month, or on Mondays
rb <- runion() %>%
  add_rschedule(on_12th) %>%
  add_rschedule(on_monday)

alma_next(c("2019-01-01", "2019-01-11"), rb)
alma_previous(c("2019-01-01", "2019-01-11"), rb)

[Package almanac version 0.1.1 Index]