Description Usage Arguments Value Weekend See Also Examples
Takes vector of dates and outputs floor or ceiling date of the respective week. The end of week can be defined. The output can be used e.g. for zoo aggregation. This is inspired tremendously by Stackoverflow users G.Grothendieck and Joshua Ulrich
1 2 3 | week_ceiling(x, weekend = NULL)
week_floor(x, weekend = NULL)
|
x |
Vector of dates |
weekend |
what's the end of week? Default to Sunday |
vector of dates. can be used in aggregations, e.g. with zoo.aggregate
weekday names in locale (!!) If you want to pass in a different locale, use index instead. Also accepts index 0:6 (d0 = Sunday, d1 = Monday,..., d6 = Saturday)
https://stackoverflow.com/a/4351626/7941188 and https://stackoverflow.com/a/16193667/7941188
1 2 3 4 5 | week_ceiling(as.Date("2021-03-24"))
week_ceiling(as.Date("2021-03-24"), weekend = "friday")
week_ceiling(as.Date("2021-03-24"), weekend = 1) # 1 = Monday
week_floor(as.Date("2021-03-24"))
week_floor(as.Date("2021-03-24"), weekend = 5) # 5 = Friday
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.