View source: R/closest_weekday.R
closest_weekday | R Documentation |
Find the closest instance of the requested weekday to min(x)
.
Helper function for thicken
with the interval "week", when the user
desires the start day of the weeks to be different from Sundays.
closest_weekday(x, wday = 1, direction = c("down", "up"))
x |
A vector of class |
wday |
Integer in the range 0-6 specifying the desired weekday start (0 = Sun, 1 = Mon, 2 = Tue, 3 = Wed, 4 = Thu, 5 = Fri, 6 = Sat). |
direction |
The first desired weekday before ("down") or after ("up")
the first day in |
Object of class Date
, reflecting the closest desired weekday
to x
.
closest_weekday(coffee$time_stamp) closest_weekday(coffee$time_stamp, 5) closest_weekday(coffee$time_stamp, 1, direction = "up") closest_weekday(coffee$time_stamp, 5, direction = "up")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.