Creates a schedule of events occurring in the weeks specified.
in_week(...) in_isoweek(...) in_epiweek(...)
... | a numeric vector of weeks. |
---|
A schedule object.
The type of week is determined by the function used. These week types are
built atop their definitions in the lubridate
package, which are quoted here:
week()
returns the number of complete seven day periods that have
occurred between the date and January 1st, plus one.
isoweek()
returns the week as it would appear in the ISO 8601
system, which uses a reoccurring leap week.
epiweek()
is the US CDC version of epidemiological week. It
follows same rules as isoweek()
but starts on Sunday. In other parts of
the world the convention is to start epidemiological weeks on Monday,
which is the same as isoweek.
my_dates <- seq.Date(from = as.Date("2000-01-01"), to = as.Date("2000-02-01"), by = "1 week") happen(in_week(1), my_dates)#> [1] TRUE FALSE FALSE FALSE FALSE#> [1] TRUE FALSE TRUE FALSE FALSE#> [1] TRUE TRUE TRUE FALSE FALSE#> [1] FALSE TRUE FALSE FALSE FALSE## invalid inputs will produce an immediate error:# NOT RUN { in_week(0) in_week(54) in_week(1.5) # }