| closest_weekday {padr} | R Documentation |
Retrieve the closest given weekday
Description
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.
Usage
closest_weekday(x, wday = 1, direction = c("down", "up"))
Arguments
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 |
Value
Object of class Date, reflecting the closest desired weekday
to x.
Examples
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")
[Package padr version 0.6.2 Index]