thisisnic commented on a change in pull request #10507: URL: https://github.com/apache/arrow/pull/10507#discussion_r657098046
########## File path: r/R/dplyr-functions.R ########## @@ -442,3 +442,37 @@ nse_funcs$strptime <- function(x, format = "%Y-%m-%d %H:%M:%S", tz = NULL, unit Expression$create("strptime", x, options = list(format = format, unit = unit)) } + +nse_funcs$wday <- function(x, label = FALSE, abbr = TRUE, week_start = getOption("lubridate.week.start", 7)) { + if (label) { + arrow_not_supported("Label argument") + } + offset <- get_date_offset(week_start) + Expression$create("add", Expression$create("day_of_week", x), Expression$scalar(offset)) +} + +#' Get date offset +#' +#' Arrow's `day_of_week` kernel counts from 0 (Monday) to 6 (Sunday), whereas +#' `lubridate::wday` counts from 1 to 7, and allows users to specify which day +#' of the week is first (Sunday by default). This function converts the returned Review comment: Done -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org