View source: R/datetime_tools.R
consecutive_week | R Documentation |
Sometimes it's helpful to be able to break down elapsed time in more granular units, like being able to say, "This experiment has been running for 15 weeks". It may also be helpful to say, "It has been 10 calendar weeks since this happened". This function does both of those.
consecutive_week(from, to, tz = NULL, iso = FALSE)
from |
(Character or Numeric) A date in the ISO-8601 form |
to |
(Character) A date in the ISO-8601 form |
tz |
(Character or |
iso |
(Logical) If |
A numeric vector for the number of weeks elapsed.
Desi Quintans (http://www.desiquintans.com)
consecutive_week("2022-01-01", "2022-05-02", iso = FALSE)
#> [1] 17.28571
# Same dates, but they fall over multiple calendar weeks.
consecutive_week("2022-01-01", "2022-05-02", iso = TRUE)
#> [1] 4
# Note that consecutive days can spill over isoweeks.
consecutive_week("2022-05-01", "2022-05-02", iso = TRUE)
#> [1] 2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.